CT30579

Last windows of Corwin

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Deep in the anvil district of Hammerfall, Corwin studies rows of windows entries. One clean number will settle the guild's oldest argument. 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 <= 2517; 0 <= a[i] <= 1000000000.

Example 1:

Input: 1474 1006 647494461 176309160 209708608 993429662 890582912 219329366 476642371 131463298 389001749 166006858 30614135 311060234 147561713 613162263 131588511 942212833 252484174 189609809 888357211 405762950 108840757 255330966 408007007 993162960 48765490 756843910 568069955 804026716 33689671 77633108 55703087 198960024 293450945 24257610 393726606 920660625 15805560 617020919 205084821 108894395 719665138 21711262 812589742 679173556 680371580 555483302 935542333 226339065 898315827 442228086 255765994 604739449 605533960 700729301 725775242 501484035 903532450 492670634 936578113 537720618 709458069 819424615 261256452 539758553 816295567 299477497 275472353 614852509 884700038 454795771 400923526 550431436 227282571 19683198 928739431 206149186 782706699 902409009 436354401 847303202…
Output: 497858795188

Example 2:

Input: 1891 835 155061138 256284895 782584623 574792450 663964060 231791059 445716835 738882986 310751121 419759944 877058248 305970006 590093959 298254521 848016535 723964561 494721867 971745362 793853941 103336375 120374806 968705793 962833699 82868903 721607185 932819143 641803782 382738849 330035088 477293638 734383463 230331972 327664693 879638811 724238871 55402931 160204856 600355205 889214029 307170917 959748941 31538287 345255435 696908500 857742041 763848582 822416944 81029370 119771510 104816919 784843299 239447685 91662392 481406520 2976001 115269642 183112562 559253587 180940254 499902151 807283581 355705610 150277891 15620081 780838634 6601584 441675385 402967427 636241325 769799988 820436723 235032194 59647938 604329357 587095690 501572380 524953628 876913472 867177382 96510571 911…
Output: 402642334707

Example 3:

Input: 1145 622 334014640 795511344 813343584 145518467 373193829 440251590 291313623 964285757 718887122 451754948 350209920 69336928 513789916 349787033 487144712 645619531 616087534 530065403 536612805 651571185 109719068 279584221 295380674 623566700 509699954 178335406 907411558 976510099 848619333 187726124 733416491 841326046 572255324 392536164 388759526 775759661 619478431 729569003 749596055 946163367 690878937 258344676 263825168 171813957 166464021 847653420 425605916 681656024 342603347 569453762 979618213 40856931 223229054 729978051 335250000 379996110 90232196 71995811 480482853 655783899 40529769 567852950 278348348 901548478 300113905 471538705 506679740 691620480 964532177 279903051 401526659 178712422 890748677 798250745 26932874 765892815 53357385 751953771 496191633 94400167…
Output: 310273187373

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Last windows of Corwin - MEDIUM Coding Problem | CodeTikki