CT51225

Manav Counts the scrolls

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

It is audit day at the crane marshes of Stillwater. Manav spreads the scrolls records across the table and picks up a sharp pencil. 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 <= 2515; 0 <= a[i] <= 1000000.

Example 1:

Input: 1491 397 616992 876829 717546 468327 670858 124355 151804 528225 384835 405287 13470 146868 17528 899636 17457 197935 468112 522642 931941 373806 459869 999168 858897 340256 691039 816960 259165 355509 867774 76483 57264 793724 52448 558796 324619 680857 566245 233469 82188 460306 75030 542515 404129 91118 774672 573071 321705 783220 293704 3859 912144 439483 972750 960274 83760 353452 193848 121110 775935 396117 91765 6532 337062 606979 762842 196212 155942 215633 2676 536599 741579 592922 800498 238377 853862 147347 198167 508393 858313 333452 74283 338712 254899 862770 665903 53816 76522 461053 23403 732540 896879 275607 43724 52092 361783 281345 902497 34219 631030 338096 808588 200057 72746 320382 500317 307381 570286 427253 722376 818621 984902 980231 585044 674140 922216 97267 84292…
Output: 195429818

Example 2:

Input: 1773 486 243597 253577 330916 148509 653083 54225 690957 471760 121637 880150 425381 861272 537488 720046 159567 193224 158712 640029 619708 507294 665076 150921 615669 461370 859788 957126 192322 82553 300719 861232 645021 987548 479760 777910 647536 676729 149216 821290 400816 177958 724560 39876 346174 305306 682007 631097 119562 195044 701194 579782 624279 677086 249423 489266 200575 790295 393777 495857 78190 635756 484224 747770 21731 486759 624897 627774 774256 221512 632247 838425 154010 563066 843933 725875 686279 526828 134801 445713 811469 541878 150784 660998 173738 590237 956461 321994 972486 924458 986494 183057 460089 701613 786926 599904 294949 783415 398582 626036 852025 461652 963916 508693 641919 532869 834632 39777 617948 916179 988393 651698 955874 658658 340194 452703…
Output: 225739663

Example 3:

Input: 2472 769 298807 133856 372425 894856 273679 335670 130320 255139 984938 865339 86309 380046 490879 335162 973619 405172 939933 320278 447059 522393 633305 104876 177363 572817 331704 644381 884581 616358 765115 309488 136262 908379 983107 670447 187444 648202 390258 402851 393329 45851 78006 860047 58227 8183 817965 398407 471094 778608 728067 298929 316733 617491 253478 328720 695207 207459 223891 186950 872955 909689 522701 493818 952875 142450 705331 338933 21017 727608 984904 819003 671376 755827 312285 318464 829578 691933 664789 870770 763788 513697 59107 507404 367351 255247 463408 513667 532492 955027 264652 167162 801554 574510 612226 631265 303094 300770 511910 775267 238613 512167 110086 877127 678966 45280 905814 496446 966210 395579 378878 468510 761095 554049 735412 879932 85…
Output: 363730101

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Manav Counts the scrolls - MEDIUM Coding Problem | CodeTikki