CT40111

Surveyor and the Azure stretches

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Caravans arrive at the valley of Misthollow with crates of stretches, and Surveyor the measurer must account for every last one. 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 <= 2684; 1 <= a[i] <= 1000000.

Example 1:

Input: 487 292 705959 645055 353829 185364 186751 861769 242814 103423 455090 349261 540215 117242 550812 615199 409603 312937 988131 124508 31279 793515 787700 365316 190074 986078 793792 834366 2724 527149 170507 171018 622121 215896 679867 556048 261546 956880 488507 350915 848180 104027 846151 28936 504808 276139 316008 529401 580425 823842 438069 814109 133011 372992 787925 542631 717016 519784 395056 647892 149295 186281 624423 495286 677033 897176 938730 857559 176700 543981 941647 679446 733478 540306 942030 496009 934378 76932 870581 818610 416608 125461 647278 271845 861932 849103 817729 238324 679195 226164 765342 521571 817736 405328 31740 375969 47419 59999 101833 622791 137343 947464 180181 265541 926440 291393 798237 698900 73440 264616 705429 709273 563460 571802 124721 514687 899…
Output: 143681901

Example 2:

Input: 12 1 353627 206021 9482 405895 394725 616169 319803 201954 674874 248557 617308 922376
Output: 9482

Example 3:

Input: 1847 788 440326 938859 668320 963640 408377 196808 109700 875643 232668 697022 337596 157444 660242 190779 868786 1854 164692 793694 724567 560431 720642 508449 182679 473658 327296 631807 361062 812127 995473 412451 205768 447587 142001 618259 563941 197759 155145 795000 788052 509125 269413 629791 446761 356394 38322 871994 610622 637632 90339 425722 270203 97979 776736 773878 927617 478283 20767 611369 773823 524630 379241 660552 873631 658311 620603 960970 797733 764589 331980 199189 411683 80208 547404 253210 607158 191030 914347 7541 717923 725688 120489 699948 30711 212609 246659 761158 434253 465761 575362 37567 380188 601133 426762 249295 947688 572703 429969 750737 503923 676145 216829 691326 728577 291412 559797 860196 525998 965486 400243 988613 643084 129703 504527 351904 6457…
Output: 376096107

Constraints:

1 <= k <= n <= 2684; 1 <= a[i] <= 1000000.

Loading...
Test Cases:No test cases
No test cases available.
Surveyor and the Azure stretches - MEDIUM Coding Problem | CodeTikki