CT34991

The Sunlit segments of Axel

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Axel inherited the timber yard at the canyon post of Redrock along with its curious bookkeeping system for segments. 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 <= 2431; -1000000 <= a[i] <= 1000000000.

Example 1:

Input: 731 252 51569714 995778497 579847890 278394890 788306616 87162565 448123362 218143138 712818660 211847001 5927393 885421969 258645023 356217632 916608760 537799840 770443803 860803032 442599808 979092936 630193117 863025004 922109302 482855063 918765276 448939706 282558260 152060317 408338902 526909886 255978705 522038820 216703985 605645668 988839843 435005355 503619439 416407324 274195160 634899973 314549367 479760587 184338628 261318771 538046880 770970533 954554909 796456608 414351447 474562676 423627394 841161522 931170414 614705367 583393759 56358876 720025436 404003243 936470667 708888659 404460317 18265592 956104523 84959941 660759967 729828266 890508839 450917962 595778374 681155960 785230867 562771 715662803 317815034 343366488 113689320 947334491 805244441 577181817 156053593 17…
Output: 124020558136

Example 2:

Input: 2303 1877 281783445 923327641 410231883 674326746 102559833 269598406 977280565 635809388 713123206 585011366 114387075 646366259 266066443 923271095 643734270 392051483 89015852 200177830 660904895 578386643 312245298 942527364 795443338 933669682 476695691 474142707 991535407 181695035 470777496 609764250 209072866 287825772 622014762 896601326 328633693 668311382 250667930 592601204 854408043 455308994 948309303 737219601 718961370 80871427 325614276 599815349 223897831 920553153 757672993 586962130 815734390 731044373 791602312 220977847 371345458 783946698 917862882 892850025 494528082 609537479 43037379 281010400 870580085 550136276 151388900 827183881 122102346 173985937 946610779 248956018 344023624 390396361 724561748 758840249 99250261 484454123 165210377 596721765 395231409 6257…
Output: 946007932910

Example 3:

Input: 417 207 154714366 952747581 639234255 740024235 984184074 87067630 505431556 842285162 695381594 909122367 485936140 482364284 634077288 656770091 958363845 258351094 381770388 368398380 951119729 488712553 855792008 525811944 740872431 952273439 428687215 817892461 705372962 610781551 968187684 951615818 872912363 200278310 232771041 692052529 589079259 883534252 332440691 859677875 518727929 472693636 971802740 605860227 897394221 585443639 925734424 176080368 776978616 385113285 753438199 625322122 606381472 437515108 166001598 231442311 941829575 959396879 6899678 334935402 500329784 256623379 692139461 896026456 157829350 869716817 996599415 666126554 891939118 913122889 959354878 62897155 13571998 266970030 338543314 333010713 874598047 353350497 270772066 588952369 254964465 5720891…
Output: 100569898970

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Sunlit segments of Axel - MEDIUM Coding Problem | CodeTikki