CT30840

Ravi's Wild panels

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

At the steppe camp of Horselord Plains, Ravi records each panels in a worn leather ledger. The guild wants answers, not guesses. 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 <= 2913; -1000000 <= a[i] <= 1000.

Example 1:

Input: 2496 367 -474830 -82375 -568980 -133442 -102958 -494415 -285761 -907812 -773693 -632393 -76974 -320303 -672116 -351193 -177046 -828321 -109915 -376906 -68411 -388287 -556974 -350778 -974010 -65487 -607990 -663408 -160856 -434704 -645180 -742012 -79766 -384331 -185042 -58555 -563416 -24879 -978679 -987176 -610131 -396383 -177519 -817884 -610732 -126339 -973819 -395620 -396211 -4642 -155479 -158309 -666287 -757180 -459224 -971735 -443932 -136038 -24983 -702707 -653950 -852662 -761617 -384712 -792194 -750553 -678084 -813782 -994896 -430218 -596109 -761711 -283559 -39433 -427006 -298761 -312373 -887700 -299101 -64887 -365374 -428700 -379724 -385261 -164924 -482075 -557676 -177464 -887367 -777638 -553302 -914335 -647744 -923906 -718291 -173487 -681848 -109275 -664729 -817650 -467815 -574575 -35…
Output: -195225148

Example 2:

Input: 2279 1540 -903631 -899474 -393141 -596417 -491771 -290809 -66680 -721834 -441884 -264931 -234075 -20867 -501780 -560697 -331498 -108408 -160554 -159855 -807380 -176006 -879648 -605115 -622491 -630638 -383441 -988436 -357102 -986358 -483402 -651678 -475660 -863172 -983454 -200916 -71740 -981130 -899364 -956183 -680894 -324214 -188125 -699651 -616835 -852116 -198839 -905761 -522894 -413548 -392013 -873779 -654490 -267696 -816951 -20038 -739313 -183167 -62301 -569580 -756202 -670049 -562711 -342531 -687751 -670284 -207405 -764195 -895046 -730791 -550877 -206880 -375611 -998499 -475638 -279886 -80581 -108423 -781755 -981659 -665721 -666179 -812978 -605523 -268172 -791818 -900512 -460972 -508099 -199068 -559649 -493698 -907746 -876795 -754694 -990695 -700160 -97770 -50197 -866255 -762165 -86463…
Output: -788176452

Example 3:

Input: 926 674 -961560 -657001 -104031 -15393 -724239 -76117 -489869 -314234 -436051 -35213 -668379 -131212 -195663 -547900 -824053 -845211 -410584 -18482 -22693 -449746 -950092 -415225 -734076 -466211 -850720 -630836 -703773 -368357 -428283 -616523 -523126 -643210 -508035 -426024 -852689 -976084 -945200 -524008 -881485 -452962 -804148 -824335 -640216 -231339 -614877 -766943 -86537 -816229 -542256 -117822 -999053 -189148 -912053 -152570 -858210 -840833 -377807 -697383 -728462 -874715 -742439 -525643 -327498 -33385 -862121 -85942 -224578 -762049 -905527 -621830 -585699 -722471 -634810 -525246 -393912 -960954 -46563 -77102 -145600 -562083 -836328 -33904 -426974 -874192 -564662 -464930 -974693 -772005 -549913 -352225 -963572 -394588 -907176 -507202 -547601 -810708 -492826 -495061 -565487 -888988 -25…
Output: -348781347

Constraints:

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

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