CT29763

The scrolls at Emberfall

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

It is audit day at the port of Emberfall. Ivan spreads the scrolls records across the table and picks up a sharp pencil. 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 <= 2505; 0 <= a[i] <= 1000000000.

Example 1:

Input: 1350 1216 418725178 894467247 224599413 443055930 534208711 178749957 73304976 122371991 179894210 480320432 545322118 874087494 918144098 48478688 294264828 921715845 567252974 332542415 364494159 506132121 949407959 499329835 314557449 47046949 977332650 263706720 69712951 878035402 503583001 319938388 70339827 568816808 108111356 460339318 939566307 239843278 724699430 76924888 187757316 85245375 503583352 481386102 429940448 388618351 174468561 273990518 869912365 357924054 445198946 203101028 150362565 417075725 750820617 599834596 835306450 509081320 309540071 437845522 305522967 74660852 411347169 476883391 772734796 962489936 213726838 749928912 392092438 347706073 338284171 333985020 718357473 183799358 261902084 997114218 447630684 115721073 163748504 6608586 367797648 451785213 …
Output: 602625184199

Example 2:

Input: 195 188 320235627 793054002 753480006 469384584 490795212 646355098 180545565 89294880 266699124 705121475 755842451 470683789 837538683 381998550 460689916 840796960 698817781 470544509 101766326 353405515 871403830 629974091 79841736 392755034 111758144 635994884 968788591 343929026 170538479 989404648 363080747 85294718 381181950 886614131 607157407 371065449 69861678 175580857 380144816 747699781 578539000 189357672 546535907 333563556 693737571 186414617 291403377 341024641 422434371 237494916 694695642 759962549 373579601 787974129 184659718 343527117 213864239 81809826 980936722 627330021 828386595 85594193 699609588 962075437 154244370 526032477 57776263 604706075 822740870 178015514 940467354 636281709 622252596 226557375 252588756 853963119 884806470 670838786 332960091 745059144…
Output: 93761594604

Example 3:

Input: 1164 905 674238134 509372562 914619585 119181319 335499972 827804723 719672398 712496861 49873286 739055204 583764018 981921454 199597590 534475170 86791747 589702636 274021242 298531267 780773740 903438937 440943593 651579743 835496804 66108976 964676780 138494239 726910222 994672229 748748197 244437867 773283889 483338714 544088185 748481314 380296697 399130696 99617406 125483512 850921782 917629997 262672151 374119039 569395367 993923048 169445532 375003179 303058391 718593701 91384167 453673249 223195448 541443927 82193680 934268895 649500083 731029973 219301347 387646114 533243738 229998843 584421516 235040400 932830279 932415482 176466194 838525278 12151601 231288255 645863937 220877079 331248416 971845768 916960230 538905798 31893756 435586732 765533728 794407041 261099572 88090426 …
Output: 445774476377

Constraints:

1 <= k <= n <= 2505; 0 <= a[i] <= 1000000000.

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