CT55479

Dorian's Roving Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Dorian found an old ledger of segments in the exchange attic at the archive halls of Scrollkeep. The margin notes pose a precise question. 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 <= 3287; 0 <= a[i] <= 1000000000.

Example 1:

Input: 717 92 411826131 73971928 549927914 333818716 154666282 592315951 575817585 252256914 461400340 38885426 197316874 498646734 99085626 275124843 902640562 439193036 876663363 78708757 936122645 696404903 375456328 915005920 464258640 613405488 193924785 566692820 271003440 574478458 912499105 789710616 549688502 120007982 371576745 104426845 373465622 661784709 500629956 949080154 293741307 361120499 104743409 784265206 73727821 581001514 650102961 333525459 224417621 282510281 490243912 295269262 828690474 64020326 602839706 319169295 431527520 129765606 78342378 345218669 712616631 938659384 338284098 20103189 468528191 946755294 305211817 282230690 695785721 981602110 135689683 122113091 193213736 883172386 229218595 231550686 950304925 58161570 589712517 175205160 893715720 521645486 96…
Output: 42652716047

Example 2:

Input: 849 496 336915611 758406767 56058174 442369457 833292001 721251213 894671540 677163136 782221651 595113674 688899752 682841426 115286252 813450018 231358023 616947875 73018370 233091667 896263439 151801415 489180090 610522996 685307027 789224602 781355248 391349021 374959331 497688232 761633201 972244449 894606225 389902021 626470507 198157875 931190372 667080973 730792703 349684393 457480066 145564117 27237666 381923550 712071556 26149107 296287469 858101574 795904582 512913377 35249340 62173065 519251144 607205731 504520214 15046838 474929997 206746859 556393239 41203271 236159374 37371393 506849120 257443506 96849606 774723463 234263894 535895161 45994650 473965966 117630689 415613156 680860649 663219432 591405880 788911143 494370450 115629321 318743044 708165459 543537492 31415727 7625…
Output: 245038111962

Example 3:

Input: 843 61 114582167 552833757 224514477 867424466 377487450 453667203 85224500 884782064 154785440 769097117 978161806 101835443 305215342 211288518 123099877 55835289 520942176 138567302 741682797 77739899 760890212 373637528 888332312 337252063 535194298 797034060 149352944 39472178 42363044 788170291 137313661 21307530 754141758 879633310 869221100 362963451 279396446 771311346 69622916 113005133 265406412 106590199 429127925 812660588 846842545 675014195 489656073 925958144 570492819 631807341 403139122 854435457 414201761 731732478 989539147 299982716 206224923 94738634 471479826 531023577 99247417 37886340 606820416 123984167 691893031 850975965 1982338 635476444 935532439 392844521 733899150 991271436 78013788 791387924 297107430 852877302 9592448 468820075 613824246 887690490 99314814…
Output: 26565757528

Constraints:

1 <= k <= n <= 3287; 0 <= a[i] <= 1000000000.

Loading...
Test Cases:No test cases
No test cases available.
Dorian's Roving Ledger - MEDIUM Coding Problem | CodeTikki