CT29759

The Longlegs Calm Window

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

The surveyor Wren has been asked to verify the ledger before the auditors arrive. On the desk lies a long table of scrolls readings. 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 <= 3782; 0 <= a[i] <= 1000000.

Example 1:

Input: 1193 852 3782 427836 364462 788000 607304 749265 169146 393660 390078 925078 884913 284581 900063 168802 588873 131847 551081 977704 174609 286859 419624 108763 961893 184129 890383 686053 947319 402791 402518 653765 300207 33180 553405 760738 787383 935686 330405 406419 682348 992912 5929 104510 661725 846607 137268 608569 956196 444102 650521 70823 922959 443444 549852 689701 728464 533628 187869 591540 169160 861380 864472 839996 721045 910169 537063 930386 445885 30743 992011 471604 807618 140720 331517 582995 425708 123213 16259 563037 708558 568807 112970 16352 816614 2101 972876 880859 387996 870325 504057 690629 208916 807163 849061 550316 255007 820726 998679 53050 189804 891820 893360 262654 478697 301866 558773 403434 646728 541460 75664 968681 40347 195436 555309 653629 896921 …
Output: 439120085

Example 2:

Input: 2109 660 530320 74537 695774 317921 474872 508500 6562 706237 219958 849214 232634 261136 970691 545533 742557 21110 939869 291554 944192 79463 351399 191980 308876 900759 852681 670493 651618 650689 408868 737759 336265 985426 224300 230929 827776 472355 739722 768573 462623 473470 976096 480123 535580 869979 941501 682953 836021 520895 33838 642130 152742 700909 263050 464654 143815 71509 669674 165579 681428 377697 576158 88636 785982 628089 193477 64346 849518 34738 333275 371114 248473 433992 210683 254855 964566 977456 977758 283207 290414 61434 577624 958885 780669 44435 93601 738483 125086 551536 339623 216771 394390 954007 238019 609349 452906 992675 284817 168674 795046 465954 870632 125542 911033 593569 712113 13738 804022 211946 621416 658305 46019 225728 899864 876563 885330 4…
Output: 321031854

Example 3:

Input: 1384 23 844233 523596 655377 655300 95402 137811 61223 424246 118793 398538 952773 604594 528539 616551 501324 548608 259720 402440 862357 29815 94043 700396 137344 653540 316252 646865 221036 193814 278656 410357 145604 266005 591494 725379 12433 167518 711990 56798 338443 256709 819231 277653 971203 238739 376713 808504 586193 38770 890499 771758 724020 658415 450997 762829 217689 234078 412099 739340 758962 611176 341611 969912 197995 616930 117372 222544 495939 778866 72111 473916 819862 940027 118994 878454 214531 459911 424245 853987 198945 547632 717897 237508 578877 164934 575774 847370 11486 808568 331414 947241 784556 690278 911445 453228 556673 662430 933114 516549 143701 168193 623398 816755 40714 567651 160707 218887 763503 239261 202084 632673 10289 349586 537042 436392 13902…
Output: 8051375

Constraints:

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

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