CT44233

Urmila and the Calm Window

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The store warden Urmila has been asked to compute the guild dues owed. On the desk lies a long table of stretches readings. Task: Print the minimum sum of any contiguous subarray of length exactly k. Input format: First line: n and k. Second line: n integers. Output format: Print the minimum window sum. Constraints: 1 <= k <= n <= 1976; -1000000 <= a[i] <= 1000000000.

Example 1:

Input: 967 732 98520037 385260697 403081433 546505644 373873480 564686642 489084065 434213083 73221518 278733538 906405998 226247597 840739208 79492992 815281946 343166736 725698311 9873295 129436888 472550499 456364509 328590279 101947981 768120588 178330295 387545297 289275477 714984546 538672836 878253225 557817046 582846420 241725273 193108959 246339456 340451568 703706023 598774194 69248804 22685871 752499960 845953296 565419456 431212160 35340791 387155849 105006039 389583545 158000709 315790474 136523827 255686773 723531908 303873909 105591354 158820307 824603659 613227009 162259138 257061565 194117107 104536556 403743588 71919039 393450205 958298725 786080 879267236 108938273 517264122 304957809 146674123 860074010 505053119 901920434 748566902 398915998 872800695 630913715 247487979 3573…
Output: 360962986046

Example 2:

Input: 1438 405 622314016 398771198 52362216 467824680 948664493 75730729 320233779 314899771 525383937 703898514 892889029 564301415 585469096 562076862 126098822 269047839 308782960 526496219 479786401 815698151 595703068 392110484 498177736 516238737 530312596 170444016 970771700 232825384 66242240 655993670 529586486 73592055 1015185 775588877 728218666 220938689 147976784 467352550 413175972 925906246 637779807 796776029 725576166 747871215 130029148 371163560 218992386 692509080 336661377 982382863 644248958 799032176 242313876 132924352 905603898 809143814 619640579 883207213 663826319 442402243 343457257 849987951 257005295 182591203 798278606 824706445 788255028 687941513 730887272 922611804 368586777 467650764 786781369 26624743 623896206 133504052 926538405 600799143 289656541 71906413…
Output: 193334187670

Example 3:

Input: 1622 962 108280751 564748456 166315304 548869805 754974369 520630970 146347952 414825697 339890455 955588416 839206877 752743220 845149446 940313971 183821876 848619669 744136631 647985457 8153589 452852171 720522654 28697967 39980278 782696837 737258758 404999311 814598250 999488553 372993575 158448972 905170569 648732923 11465533 725672578 245481135 814763245 794507221 991308166 244402055 391900685 564397306 115312502 132093268 736591042 779286830 160223458 867062948 352097673 521966252 860447325 413205993 372212927 959708160 270853140 65007496 636058718 18781285 896420553 371357891 518605659 420101638 -365077 333550230 860091201 568849997 765713442 326947487 129901116 665312745 425442285 209625879 776520498 154983310 135762606 619056684 559277624 99291446 951857219 584847332 119966889 2…
Output: 475301802924

Constraints:

1 <= k <= n <= 1976; -1000000 <= a[i] <= 1000000000.

Loading...
Test Cases:No test cases
No test cases available.