CT36022

Painted ribbons Calm Window

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Tomas runs the loft at the saffron fields of Marigold Row. Today the books show a list of ribbons, and the numbers must be worked out before sundown. 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 <= 3477; 1 <= a[i] <= 1000000000.

Example 1:

Input: 1353 1216 792855225 254826088 172868374 75600732 874178391 911656914 415520926 148146427 786212127 657618299 551740464 882752673 923128574 319307469 856642116 618536398 616007750 953664837 768658116 759636757 512325337 294393590 414425158 294922887 653458259 334547417 987956467 938961148 793326314 441570505 504037716 166030728 834088492 61861245 76728542 251947957 211959695 531058595 421408331 200469147 18755307 111563802 887524112 86705817 569884521 515685037 456581007 814131645 585333747 589094239 153916020 288767967 374982864 424885391 31499670 609460847 525095334 356930160 923013558 634884124 924981581 198631110 480289087 504509256 398418326 15753204 14097928 412072263 660033319 894140266 340360070 244807624 527898215 340391193 411161047 908500516 104920891 134145325 130221749 19001355…
Output: 604866800439

Example 2:

Input: 1712 618 467514964 924223641 249710947 14755593 697851895 79520743 487426707 684531237 174930453 59493917 953139355 569283831 461282827 524172041 254636317 26060097 307946152 391090112 240428486 198020757 108436282 773587209 609824057 998084965 310866091 898324885 715457329 298161390 225792554 917996930 717475505 317451662 137790021 935660986 609941723 376578724 32435709 309000034 716823469 345122053 813794673 838871237 805895632 6826547 73645357 320317475 331420015 201173306 80440445 5689104 806924391 794745951 287868679 693676806 678771595 668473693 256268586 600645762 141421148 228491887 77179793 581528739 615248277 854727206 380516405 664607922 534292808 461560036 804084622 908242186 683407821 581426687 42913772 696939102 506097667 25586876 33428346 988166078 885808015 454815193 825871…
Output: 304365495495

Example 3:

Input: 1097 1002 302799598 472880287 387215547 384795684 479381447 487322798 744645861 870567786 673084490 39248794 235214351 886956541 671212247 935481795 852853644 182331305 457294516 297632190 317657637 634509778 380874593 481127819 890461846 73121908 539269511 463261138 813777333 378580458 883010372 956394184 318176045 133900636 937361047 223547861 608358662 914440489 216761091 77730337 885764561 427045004 788406607 739652452 97064740 488725707 506075632 10205914 484091760 917417777 677462013 617655909 311030849 42676619 854758667 372538842 57842524 886604906 481305930 55717152 20399658 261820730 143243574 625011632 481456442 89635667 598103475 142167382 669468254 137722296 67444534 398403836 900907195 431845655 528838302 70930111 211769616 197464790 377923858 542683333 167163465 157375307 91…
Output: 500129876162

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Painted ribbons Calm Window - MEDIUM Coding Problem | CodeTikki