CT34620

The Calm Window at Sandspire

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Caravans arrive at the desert outpost of Sandspire with crates of scrolls, and Zane the chronicler 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 <= 1632; 1 <= a[i] <= 1000000000.

Example 1:

Input: 1172 370 496468994 653888665 426598525 538537615 429996366 595102042 417644492 69328284 859569362 407521926 128530644 490396212 259438829 254970568 78204886 912813339 882332046 194139649 71072664 22690011 905578850 718220308 80916041 226383987 453281612 445359923 976309431 931420673 630012193 418100707 190893821 399901787 259141076 302769235 703915341 474700988 845953208 537710305 32979839 757988289 732448250 92286898 335439052 765573113 858116028 485149649 1303335 820850408 374676567 462022388 904486939 755013243 702257484 799876468 201955504 897108356 989075512 665946920 629890102 886887428 326979344 650137780 831673261 148232209 807982557 489466409 135873046 470780543 260510217 691738115 749883473 214139563 14287916 627551499 272370618 747014999 966281204 323972250 864773491 532973554 8…
Output: 180964561765

Example 2:

Input: 911 643 688110382 394444624 160678282 617119177 654082948 780139740 276088084 163374063 157160448 537218226 555237436 388447303 392986587 316099092 656978745 911773056 248633766 716140158 492223739 857208519 424879175 631392095 846220532 806228013 391424267 44445228 92657997 314507972 352249195 935817548 357445586 499685869 637614074 621609311 603286567 490336328 544198840 423435781 953763095 500724723 87531669 464085359 187500832 566737553 119815532 142686176 94402530 115893957 949736831 989748716 409977484 484881446 320324124 422782926 484176143 863203303 40658077 987935020 652445372 949032483 295597607 580965451 763857232 824629279 875980975 916723761 707166329 929792522 6661657 826093566 364162919 665817025 326851146 245726738 734854077 857969140 76886813 343059469 280145643 832922917 …
Output: 294388389260

Example 3:

Input: 1620 1273 36144882 822810920 439704610 928097193 827576550 53912906 252914093 888172034 75982884 234636160 846372883 784789636 948351373 825745856 986352117 719004777 790388935 67837175 461089798 75115112 54601471 273178999 401323586 123930855 987834426 479701793 691885704 796221674 94954923 523365036 424890490 214076599 311690028 310147221 266970909 277231358 781324223 280577857 881758552 656700298 507265006 55421174 788839644 399721736 297456473 981363153 672885383 664159207 911904520 170289117 359945039 456689495 709904785 169120379 57909245 800097443 85237571 317321621 624168607 686908471 743558129 902558242 774527309 38103868 72106367 366085624 63845464 806023329 152380296 40698165 548612028 150150426 872198365 67580491 847612711 855409004 424150823 204810245 718098981 103266872 15635…
Output: 630392649463

Constraints:

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

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