CT32701

Windward panels Calm Window

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Quartermaster inherited the print shop at the ivory gates of Alabast along with its curious bookkeeping system for panels. Time to make sense of it. 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 <= 2059; -1000000 <= a[i] <= 1000000.

Example 1:

Input: 1551 449 72416 -735455 -737920 -196261 743869 313892 469026 -302647 -841123 719560 -883004 705533 -524911 -410135 -671408 -312031 -452220 387388 825889 -676610 -494787 188165 -619411 -329450 780407 14875 -196901 -999267 -701137 750554 -973363 -261060 965707 470975 547165 -252874 620228 -516279 -209937 -50122 550066 329798 -104815 598827 -240382 478843 -332146 792086 -121506 193046 349251 -735012 216054 -226424 -794804 -990085 -833649 -222759 592573 -46107 88458 98154 -506106 -888701 -31564 289246 589853 713285 627139 903866 -687193 -485005 -13669 -441090 319250 -518591 738559 807343 996507 80257 196180 135603 -484274 537490 62311 -736287 -852643 48027 -468431 965494 389105 753155 118177 258190 -929568 -944144 -281627 253003 -222215 862966 612925 -931488 -819814 600766 -661788 -631091 1976 …
Output: -6069764

Example 2:

Input: 1911 355 690099 968988 -488034 -84180 -329940 918208 -221728 -160319 -779738 574285 -518292 -210613 -208075 642265 534820 512951 -274353 -603824 -340878 -789610 472513 -180265 -904267 -86178 971416 16905 -842776 905154 213857 -250739 37074 92460 776035 -710839 -531260 -869882 11966 -230667 -552487 -836415 432479 -667375 581388 -831036 -929927 -939178 72802 -408313 664089 -252780 294535 879712 383520 425197 961429 -375355 -961143 319848 273431 -749011 -585325 746200 -610474 669520 219729 -465024 -403707 949386 31642 -754275 -989323 347334 600727 150819 -297961 392371 714788 774383 970649 -626949 800664 -781978 827128 775302 -476196 -665767 -39336 275797 -223950 -582990 -171993 -437423 -74607 -537750 -747808 685748 760330 604026 -187905 37002 -926993 19206 852416 -459366 201138 -367984 -9472…
Output: -7397849

Example 3:

Input: 1009 856 734571 -229276 -861790 884431 -912009 -517274 939511 209436 -99737 990930 -797985 -636766 128759 729773 -245136 -413561 -469184 -859538 -675506 -98853 268247 -23039 -818694 704032 -779687 586403 -433052 131307 -377813 213491 -57257 -183632 32516 107382 553880 409246 -167010 -452335 310746 433095 -703903 -69092 816196 176298 518423 450268 -828249 -631805 835530 678249 -762037 -254193 -782637 646517 -245999 -390171 -692893 32817 -204459 474695 -140982 452120 -349313 -406047 -971254 521350 751144 -202531 521317 -186975 -863391 -164656 482162 682151 258457 -388406 -931868 821531 467538 886843 55269 586839 -333463 -517210 38629 844323 675661 -209860 -888679 791806 -492748 210627 -967117 -996369 87211 -391290 506018 -693750 150481 -9363 193204 985879 813563 -232219 268760 -62200 -637207…
Output: -21337696

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Windward panels Calm Window - MEDIUM Coding Problem | CodeTikki