CT45520

Last panels of Chetan

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Caravans arrive at the orchid house of Bloomglass with crates of panels, and Chetan the assayer 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 <= 1699; -1000000 <= a[i] <= 1000000000.

Example 1:

Input: 1446 624 529782259 799848694 249338254 948190056 274132568 8034233 184376756 927778271 843741252 715758686 924740665 246470789 581524772 403387316 418862450 250669207 454749522 970122571 239823445 553920221 435769922 783888969 568002606 497984088 701025461 411952379 321791983 774050058 87694636 947124904 531315617 562361637 499982337 554963648 544970651 188379990 633047996 50478864 546180069 663050493 815617130 47193540 213353486 773445110 48018053 5592584 553288868 572626728 973377080 443648974 71950343 311438950 638858308 508352185 809020334 426842169 440357697 714055284 445150792 648428711 722215742 424037576 635124733 666492562 375429256 934513386 11072797 66172850 403463053 403883153 167078742 852058766 919016963 832069506 340509570 550042591 69314418 186097440 417417827 443005582 220…
Output: 292532110748

Example 2:

Input: 1135 414 401949813 260706083 464276569 600488402 359394598 616399929 775022879 144407375 953787581 943598137 569540635 499264119 56990310 289352452 211486693 866631907 84658011 699837843 257549212 976308254 904607743 184185713 419352808 183539064 406065350 940927710 142804161 187174531 787524681 765729738 565097696 463780198 491686908 421309730 881559944 431504131 429145215 129540869 207980700 58857878 916705287 403459742 346680583 611745568 637953793 152481779 915489599 705384606 342491112 158427832 682322666 888890869 673679754 683208518 561895580 730728174 855042823 709126766 43444076 590914339 770433821 412138148 942100068 805966452 663171803 571760938 265513282 674771395 356249174 304902752 557528845 897587079 252307233 74251664 84658020 77952304 677518718 216282692 101306520 78658823…
Output: 202828259537

Example 3:

Input: 29 22 582204221 364908132 387141874 380930359 754528294 215352584 855457344 764627511 162392642 39039835 510949421 351156171 694708220 378859940 211282583 7447400 319236746 882185663 874125218 356213097 565031872 120316698 797093411 991801312 972847699 813361684 932514517 745329607 422759304
Output: 9778095825

Constraints:

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

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