CT37237

Eklavya and the Zigzag windows

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The chronicler Eklavya has been asked to inspect the delivered goods. On the desk lies a long table of windows readings. 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 <= 1979; -1000000 <= a[i] <= 1000000000.

Example 1:

Input: 1021 877 882012875 354665603 801518399 838386755 929855815 797987840 105609183 683237413 353712504 703457819 339886862 611784551 553947818 151342146 564227776 81553785 109903979 825055128 376311967 837071578 529654558 147412912 894764216 644146944 956010191 791957302 834340322 843293330 908636011 813659643 751604859 303345807 157367508 897457838 566406866 804538180 958614190 116788399 642488382 518348499 339541746 341825395 908255908 648921289 465765049 733146233 522430255 94265616 30796914 451734731 100164801 44794200 462704521 443499740 349763058 614352396 917747914 175411691 303288741 587278175 354603107 617989746 215392855 533592728 852819160 36055800 386640562 982280381 248661907 187616358 713606472 272341298 813974089 224232513 998314171 375358650 495753207 649822081 173811365 293487…
Output: 430741819928

Example 2:

Input: 296 52 924531406 712128641 448522837 934957058 214499557 256436199 190563205 771220187 657946068 877085365 15075878 789893730 161954647 339769655 995654863 937869062 270258431 305163677 406422932 434559270 431999395 996398567 254283215 685229077 298671079 625360076 402338103 696138320 118210545 753867692 379807563 297955052 277386416 770919163 652641842 432229475 661022562 949403643 390775035 160569839 564818222 694400497 245624054 617737942 145581535 20084352 229115368 504226386 59474164 480408238 395246069 795984029 858350213 753141443 695532998 99576172 421120166 569448673 278519093 887856831 979416659 60919625 785075907 100735693 925067070 164773624 347769884 26718606 16619763 830365053 577661759 236462187 536404994 188140192 612299265 828745824 982583121 197356730 389134020 790171429 …
Output: 21125849656

Example 3:

Input: 255 77 248365947 970242709 45590211 88079200 127057335 25860458 75492042 851833722 940972337 221181302 983010465 425859070 150359886 691913213 689088978 563149981 591505590 903635758 640297167 406231629 814221024 224154108 353610424 1435997 9539116 124048632 727996668 411548729 812472342 421594620 851039429 559470584 35308779 965564890 115239946 779090469 978875946 13073247 398577072 711094554 122164321 37640708 592251090 924422992 686152598 411348226 104122532 330747765 637129796 134848541 242235403 835618348 16925374 697254972 796047853 81538004 479138683 426015388 282794114 528657021 422677135 785065680 764371719 934475562 346617113 863311144 450446268 248077795 420956754 626120844 916286509 504747150 165270757 60519788 804539674 758447429 562137148 827043862 23722569 96250368 711200071…
Output: 36123166818

Constraints:

1 <= k <= n <= 1979; -1000000 <= a[i] <= 1000000000.

Loading...
Test Cases:No test cases
No test cases available.
Eklavya and the Zigzag windows - MEDIUM Coding Problem | CodeTikki