CT51702

Nandini's Calm Window Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Caravans arrive at the glass towers of Prismhaven with crates of panels, and Nandini the store warden must account for every last one. 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 <= 1644; 1 <= a[i] <= 1000000000.

Example 1:

Input: 1466 1204 744612051 221166048 990257269 41553243 203115861 313591946 2022386 446892469 249257923 938388213 684376776 908577689 409424782 968913049 638444058 107410367 241534397 840316392 572333925 731273182 271592948 392216485 210203979 349397289 563613391 31830866 361546951 458281279 21699207 768370334 289177683 435424226 792335021 588081978 864556515 234112281 160615512 902905503 108204811 512087366 300235275 541785403 448293556 549043317 160723429 492624195 580576230 834148048 516911078 897331610 869451590 215294125 606280342 219446995 838789321 439067887 843713411 681499079 633835081 205767635 857480249 584912038 804362583 927186542 481110315 509137979 661297887 338705561 610194950 907271889 760106369 679867917 517503575 966675917 902915220 57577903 615135690 976560819 96910998 3343524…
Output: 593614989199

Example 2:

Input: 509 289 776897292 824542104 159719624 471546140 133948024 699183915 683953941 529973154 355798797 271350624 7034465 367605383 80473563 720681856 740872457 140007613 324945722 247008236 413666640 418909868 370454199 518479372 633772520 156969068 24618898 370557256 56507698 428713898 85991628 78449692 1804779 558162390 279943937 54632343 577625167 878338277 936139124 661649167 495165931 581474712 809765046 736519722 496393699 552557593 919458372 105329804 502278722 797201850 23650426 414962109 877695587 882333555 132487330 678555891 798206558 620026512 514865521 18040065 671522546 443523682 883774028 677037443 244660695 712670170 349009028 98472959 594476021 558296288 913219427 835396462 461293658 601743381 242980302 538096733 479728374 596521987 497707469 627045140 315918367 902292308 34269…
Output: 138550423500

Example 3:

Input: 1155 485 898204450 772467952 341284992 716605829 588740328 794323962 276311419 876526241 699078807 83833479 901065148 931434232 607278481 123363075 804959705 646604258 724774888 6854295 951627066 282288805 475512280 527123517 56051873 5825874 418975851 366748523 881157569 75048000 526462903 955220726 41585345 934730385 125470081 963050975 952392927 101857545 783868860 678107109 828618288 993095782 46781958 764372540 693315285 421302377 958536890 743548899 577285478 278111511 594067279 960871762 650942285 514564837 549429641 846736528 177070814 54331081 389059308 186418616 507483793 538714655 971252950 386132269 225022881 359599285 525541054 25151368 220204674 265126532 251232605 667132748 338975930 242425634 83680537 109904006 273227559 967029424 553593231 526826533 204468085 411770733 320…
Output: 228484644286

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.