CT37583

The Calm Window Beneath Tidewater

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Deep in the coastal hub of Tidewater, Wren studies rows of ribbons entries. One clean number will settle the guild's oldest argument. 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 <= 2316; 1 <= a[i] <= 1000000.

Example 1:

Input: 410 190 407085 676842 171937 860657 735913 596249 726695 468187 662107 862663 240432 461692 202997 778528 462257 932678 554140 809487 757471 770921 828539 584560 111648 819021 530454 447771 813898 299708 842729 50890 512680 151293 143864 338594 568378 362726 426109 821560 558196 224516 164439 61593 422107 944344 806939 353664 919270 667880 33290 148363 159988 84198 725819 202878 626407 728140 907973 59370 898448 4288 166527 623772 723862 5643 264504 657465 122650 878668 438112 541609 469009 367065 128237 155924 712410 181136 540177 225199 970564 980326 223981 783164 375587 66133 234821 17816 907601 324726 944160 719532 442628 947418 6413 149219 130875 880801 416538 814373 649983 986107 925125 83700 103757 246847 459226 58720 963282 905124 69446 892031 914915 519292 240797 823361 244002 357…
Output: 89354100

Example 2:

Input: 823 594 152691 816413 272157 423240 463505 829967 58789 286399 606662 175669 413179 522081 713044 150619 414797 416593 452475 359822 846088 443996 121347 838644 899254 328840 359476 152364 521320 318846 543009 272386 297026 441968 169297 818352 624679 665274 249948 772065 726647 583262 61909 931677 939506 6649 863127 57187 984975 29696 868879 970591 914860 152168 620563 624430 837004 687713 958033 169008 285079 447743 755025 795878 775999 18125 218605 226864 674956 826894 954196 133569 534352 150794 331485 892875 784993 303849 788753 949133 298238 539557 537080 259488 327076 831756 469923 944136 631295 849265 109808 695022 923789 964248 684188 419973 765683 12237 599719 25060 596875 701856 789415 252230 184327 167149 803242 182493 753465 53929 707252 770065 923981 210984 45413 173031 70132…
Output: 292720525

Example 3:

Input: 1044 321 552486 865848 307428 805242 901529 590948 83058 334102 852029 350245 727809 902229 920220 919157 380146 664187 832333 497862 518715 553137 675249 214564 576350 711386 276992 545415 360153 71241 748274 242241 422470 488022 451287 822044 964067 379111 170583 274348 651492 401106 342718 302858 99321 508479 637605 879300 206901 141955 550636 661225 815522 787003 222432 264013 704870 704474 555338 325043 181761 641369 14606 448845 980820 897280 265162 458282 44974 87028 470568 298642 607093 708422 220839 650717 184430 939208 931310 389822 20402 241042 424291 377392 165972 798227 277941 433284 491613 262949 194960 399954 811679 77529 449666 560558 879240 198063 373446 916435 745202 504428 872231 646372 837452 856809 983673 196853 20780 551109 20745 952523 167268 828826 965140 350153 989…
Output: 150951416

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Calm Window Beneath Tidewater - MEDIUM Coding Problem | CodeTikki