CT47704

Nils's ribbons Reckoning

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

It is audit day at the anvil district of Hammerfall. Nils spreads the ribbons records across the table and picks up a sharp pencil. 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 <= 1253; -1000000 <= a[i] <= 1000.

Example 1:

Input: 1064 34 -362343 -414004 -797250 -76203 -812493 -617455 -783301 -568148 -715766 -195926 -704714 -140369 -626983 -585393 -102768 -116500 -980419 -377320 -736725 -787944 -282008 -355838 -956615 -602089 -148871 -752118 -247126 -338926 -779252 -203538 -549051 -626857 -588352 -58007 -471559 -730401 -822052 -429714 -244598 -863098 -524863 -456120 -859206 -494617 -322466 -822044 -824040 -797019 -867041 -80994 -627079 -590591 -283205 -871431 -275554 -332441 -515770 -466337 -413016 -959866 -588893 -185241 -120218 -764542 -342743 -108474 -950053 -384435 -223778 -878677 -788549 -793884 -340586 -346836 -567859 -138183 -541294 -528257 -765852 -375203 -346057 -520877 -683312 -892340 -638474 -650402 -641961 -149659 -737231 -390861 -393636 -1332 -678247 -742371 -887311 -803880 -135795 -896468 -627363 -7427…
Output: -21811301

Example 2:

Input: 840 737 -713393 -904288 -444649 -771424 -132615 -815234 -742761 -491949 -774335 -269900 -506703 -506835 -458068 -965821 -213013 -385021 -678069 -798193 -414031 -937289 -216723 -165707 -412089 -667555 -662947 -546347 -12198 -958407 -505247 -7663 -215298 -795382 -225518 -31110 -907089 -366977 -102384 -34012 -788427 -618702 -747503 -949855 -248221 -48873 -134601 -978669 -560282 -354049 -921994 -746022 -49519 -432657 -805995 -558527 -299529 -775914 -324032 -198696 -185678 -617978 -525965 -497131 -597209 -395058 -890438 -644169 -228074 -888751 -284072 -911325 -82416 -116868 -425032 -31282 -530385 -545547 -49878 -38317 -458339 -814080 -134841 -102922 -380539 -577402 -490817 -284784 -700067 -870968 -897675 -43299 -764873 -616472 -175882 -872505 -56218 -585625 -38743 -937632 -972011 -578726 -59885…
Output: -376636629

Example 3:

Input: 176 24 -232773 -956350 -436700 -108148 -84833 -992014 -724199 -125990 -177648 -895630 -36376 -905910 -520041 -149190 -671281 -964668 -591204 -188732 -353986 -35405 -124611 -404989 -136276 -737328 -391841 -391842 -82746 -917199 -766976 -886569 -787389 -331952 -722187 -587945 -567954 -460751 -794483 -395368 -183193 -64360 -59954 -608433 -411006 -621425 -682995 -87933 -981282 -784551 -866112 -894303 -524984 -930415 -827092 -351558 -808599 -300820 -278775 -544104 -802285 -233598 -848903 -579281 -66832 -751799 -263291 -952758 -589296 -461686 -690282 -756898 -760497 -669690 -405935 -177581 -661808 -417053 -641204 -329229 -297966 -437626 -866868 -552561 -717034 -936506 -864992 -302847 -464316 -813924 -337863 -897181 -115102 -925934 -909442 -958075 -938938 -532269 -795440 -678695 -324009 -642130 -…
Output: -15392873

Constraints:

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

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