CT55101

The Calm Window of the Opal segments

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Harper inherited the lighthouse at the archive halls of Scrollkeep 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 <= 1016; -1000000 <= a[i] <= 1000000.

Example 1:

Input: 389 125 -411530 174833 -408126 -694654 760116 -975912 950231 839481 717601 -656938 268482 556140 716105 108946 -499653 -674488 -677466 -161631 -290164 -587542 297771 969112 994182 -38320 659294 558681 459408 -449500 -295329 -334513 334152 908442 -523183 -611624 479956 201006 -939773 -504740 29318 825146 970836 -377000 636043 -678119 617171 31319 -335179 -12501 575866 -64118 -494700 537520 -696241 130630 -88303 -5146 -589882 -220102 231568 -738658 -210068 -904631 572678 247431 -202081 698968 908297 65812 -743634 -673665 332573 601733 -672893 -459997 760519 -22155 991854 -751122 -671873 38271 188217 319418 722941 906320 92205 -508725 -398375 217325 777121 368193 -966651 -258840 730165 -640276 382613 -195158 -994939 -703850 513843 947945 165601 255099 -219479 182613 351653 722260 -755077 -551…
Output: -11234146

Example 2:

Input: 103 77 -843658 385 221400 -120755 -480409 796776 -401799 -426250 -16818 -670218 706490 355443 10804 962301 235364 -864528 -461384 -391020 19476 -809927 558436 -670269 -881403 -922931 -239036 -132714 -925233 910991 827643 -578811 -810980 -205445 -263273 584055 -216940 -488022 -231249 458462 555202 849769 580010 -136777 -410625 -979893 468618 -317504 651969 -159813 -888078 128948 133656 958285 -319435 -803597 -955703 219480 658728 -120199 312867 345186 428181 -253087 805315 270447 -189287 -827439 -775968 945657 -65506 -954658 340606 -231442 -573178 -804630 387839 -270672 816319 -530368 962420 -494674 -476101 -646234 -735828 -835033 -786700 620064 -889774 763745 779800 -456054 375606 -412181 -127515 826990 930539 -379466 -765182 -738102 -25997 -753250 -301117 99716 -748431
Output: -8675823

Example 3:

Input: 125 39 253550 -559202 -550374 -409008 -885701 273928 46841 -789189 -58787 37341 -513795 730705 672934 -408919 -463256 -226655 -268007 -186355 -229896 855038 -368784 236597 680838 -624693 -467963 -459720 257301 339930 334675 307698 -563377 -771945 476121 -995480 -902714 -29097 -3432 -466888 -504399 -618386 298465 -413947 787322 -95868 -187024 -892586 898315 181000 -948201 -340882 581422 548382 301558 457525 564 -456866 -468799 -576210 386992 573204 -392312 340238 -481083 851152 10971 136261 -889940 806522 555885 -621443 40388 14011 -459319 -628231 -615735 -456739 -940648 991433 703549 -301554 47037 437316 -548795 -819025 650846 306358 -186808 442189 459138 -186902 722790 -527147 -803444 807176 383183 -419885 -273664 -988548 -852789 197778 -325825 827028 919182 -396432 376427 -897589 -156877…
Output: -7076075

Constraints:

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

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