CT37292

Zia's Pale windows

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Caravans arrive at the quays of Driftwood with crates of windows, and Zia the bookkeeper 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 <= 3968; 0 <= a[i] <= 1000000.

Example 1:

Input: 1163 505 217554 110698 609779 420027 392509 396123 52507 997115 759077 280241 561784 429525 720381 65804 343200 377816 373096 190240 207696 531661 320455 489800 182817 58623 912160 175701 544381 288955 501332 197374 295125 493063 917500 605162 58857 510587 713418 446958 677277 804573 404695 792725 52880 821322 642907 824518 586872 464231 895665 263688 312624 924096 913203 260750 568050 171090 923063 971284 456405 502444 776915 143309 958897 532851 45127 88102 704087 336041 114399 288994 981807 198516 688748 440645 558807 974467 235365 980126 379256 977669 554916 950467 261390 633651 912751 544626 862909 30635 529594 820831 705764 337937 242599 398612 17720 401973 782958 458091 236700 374187 963910 851432 750102 272976 233124 762316 209520 642815 365100 487389 699927 852377 913110 674754 65…
Output: 243513595

Example 2:

Input: 602 53 470065 824099 61469 228471 78629 313049 354776 9649 405920 563921 103478 129694 496475 949494 301170 300006 239394 846011 964809 435811 444061 719181 395530 845057 453889 655396 564281 1622 931498 154700 883703 153727 140538 244802 808655 151879 874733 778407 691655 100377 582199 516371 425810 514889 622540 809013 904204 52610 108301 300674 171283 110653 267899 823494 656863 182563 563467 986679 771366 728714 686959 72134 495073 693625 757828 872969 549115 119114 579849 387148 928004 103769 907935 362190 683539 406244 156159 211094 243500 819721 447034 338809 855122 420527 500054 132581 122579 422291 61105 866041 178900 429001 569158 561419 245946 453262 166152 679794 135551 731442 518347 153185 643519 905369 603681 973431 902196 522759 10401 687095 656534 891451 332238 300630 71659…
Output: 20929635

Example 3:

Input: 672 198 368494 582576 388904 713193 580754 981733 103076 687741 742407 773692 45225 591611 234551 82392 152438 954213 205680 840173 271876 379278 278801 677361 666187 741218 284933 981323 256372 835439 473716 969760 909257 436600 974593 51870 867289 81078 760935 359868 272565 765363 665416 407519 343244 828640 279487 294634 303079 752952 181965 942625 749729 960807 655587 961346 309754 578264 255082 46422 539017 775683 956271 438594 110467 839855 591665 824852 177585 975662 692133 477023 531245 969133 628375 586070 847656 550355 300860 241300 743192 524906 980269 249354 284933 170164 518771 804213 929122 604764 597217 544420 965045 166140 531740 268231 76075 529388 98389 468414 171365 776564 718162 617462 138655 993427 372524 478654 842957 261294 359613 547305 480486 343932 501534 467947 1…
Output: 87837245

Constraints:

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

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