CT32633

The Calm Window of Longlegs

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Eklavya runs the customs house at the heron rookery of Longlegs. Today the books show a list of segments, 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 <= 3130; 0 <= a[i] <= 1000000.

Example 1:

Input: 2673 1474 389207 46047 867891 320787 402288 233359 606795 462520 738524 240762 447240 121118 151759 257691 558110 938191 136070 238072 257957 6967 859466 379495 217504 218441 986870 278065 73097 851167 430644 144666 114806 874315 800460 728304 821098 643542 512302 870589 101662 705613 817603 843782 274041 203695 903799 240949 221167 155293 687511 73255 450977 681856 308774 939539 620430 11418 253070 583437 607923 710670 247062 25463 517567 671460 469978 128180 689027 943411 255751 266003 786087 570838 193879 306681 597231 375041 97254 143871 747971 88920 4283 371822 232763 444552 729101 424744 569303 945016 151295 619628 392027 337634 598788 947582 37269 522939 918441 456693 527316 261048 624059 478383 415251 847829 771465 107696 86827 421003 299517 987063 164294 108645 628647 900848 43312…
Output: 737927172

Example 2:

Input: 655 542 499749 654561 923363 156692 418437 157488 292116 23421 780930 393258 766623 712765 530149 490477 65118 682259 584778 740977 154879 628630 317366 238737 576385 887779 753082 984261 43188 892289 61520 966712 893255 392996 119033 398393 178653 712526 441150 929261 401682 466424 632634 407004 499359 126196 170540 739836 751720 10826 227287 55987 904042 518703 723497 374312 83355 902716 551258 162747 132267 465656 272286 208896 727308 728933 186112 647243 606217 698716 938120 303739 198933 997554 476034 675434 389104 831240 319358 599104 40996 527872 352669 576169 35325 342172 905510 442849 904813 157991 501291 218761 673410 152346 969513 421334 798183 538571 347544 743961 507699 816810 441915 808814 728751 326837 137111 86303 286125 580056 679732 559430 272064 430805 818192 116623 4533…
Output: 265131430

Example 3:

Input: 3063 586 80671 288913 247740 163847 159787 895865 844351 805347 611531 66408 530893 687653 444685 310438 983125 819515 685732 867383 292350 529590 561123 423920 397628 461528 380981 907652 548286 557937 286856 36722 642300 372783 887337 870054 559840 159148 392734 264217 713614 249953 372598 669044 611426 562369 402607 113587 403689 226466 337327 816480 607583 265057 171276 449317 532294 82071 320309 19125 52101 232851 929025 959130 77734 219793 376327 779722 45776 948688 91795 877423 775929 18856 87052 613974 984952 27652 816306 834442 81641 727531 887290 282075 605628 653908 608756 664649 736976 386152 149382 401196 947057 469067 439902 137629 58453 4697 477487 744253 256476 700386 635617 894273 238109 997482 258064 744412 929605 325137 753451 569197 906677 406297 312512 471152 837251 16…
Output: 279462310

Constraints:

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

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