CT55703

Aldo's Violet Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The harbor bell rings at the mountain city of Highreach; Aldo weighs the day's panels manifests and starts the calculations. Task: All values are positive. Print the length of the shortest contiguous subarray whose sum is at least s, or 0 if none. Input format: First line: n and s. Second line: n positive integers. Output format: Print the minimum length, or 0 if impossible. Constraints: 1 <= n <= 1950; 1 <= a[i] <= 1000000000; 1 <= s <= 10^18.

Example 1:

Input: 786 230437892576 66943064 937231773 53552094 614657973 475549786 547351947 853044380 377918246 41380691 958676255 3087738 277879087 2811344 544887329 322301529 487150726 516904291 154755127 506262780 627450766 73517400 228607688 288495751 608671914 945808757 497962040 300200686 701512881 352997210 679765091 917986953 140196267 902855286 648265516 537040482 123490323 137905263 632775502 364666470 545529666 58960919 82402623 989669057 725803496 556622989 761236450 130352980 727278276 720303186 741169938 106967606 677393399 558745232 127034777 156655219 739985981 225433331 656548987 18974245 98260087 90955978 992954853 988613966 793790813 515684404 644661639 262752403 701342193 329098834 660567158 582118276 610172103 212018277 219676275 327414764 367399331 830589508 855718124 230800377 159698…
Output: 438

Example 2:

Input: 972 212661163948 710769199 344370320 600705555 567296440 526394521 838851229 690822879 796537154 523589661 657259217 259535135 221831858 482190208 269953196 169717684 840554364 796854381 443951380 798903718 154401236 588766106 865764532 856584714 147477543 21600138 331295443 701399324 782787894 42610575 896638508 840797368 646533245 617446537 730729795 424411585 338170923 323928169 781916654 481152571 30249776 113426602 279364986 729012912 37205815 302062467 820858703 969629480 119638140 952135346 892328455 690761225 89062962 245318400 936996657 956341057 987051154 226038440 702863609 677553776 987352734 318520615 467031599 558982047 965363474 478400830 544069403 977086359 787266710 941390733 898537448 563977153 160659542 493722207 177063510 167389896 165497657 43029651 305173344 323200468…
Output: 418

Example 3:

Input: 1733 847044380633 495641019 440106668 340819576 576112491 452937258 254211733 863486085 196248484 429055086 819620647 288429223 928637001 270554014 155947498 589118639 863223597 411048290 249649032 809473437 568589121 836819144 62282161 629716465 226275756 907326303 186514694 247486752 452923597 419768102 965700177 235589697 767208637 314249249 629336034 188639471 410321998 807997748 594500087 111336682 967272888 938674476 213673176 345132784 480724905 786683097 895642860 479588542 176474973 350904868 171129196 764099148 941165059 306524558 885452178 696563360 175895175 684989242 842327401 191092981 876866966 129010420 635889592 472801951 846258182 291550838 977383816 274879184 27419420 655945545 654555894 904891728 865705409 587070841 894749442 414701324 10501019 536365539 813342295 37138…
Output: 1704

Constraints:

1 <= n <= 1950; 1 <= a[i] <= 1000000000; 1 <= s <= 10^18.

Loading...
Test Cases:No test cases
No test cases available.
Aldo's Violet Ledger - MEDIUM Coding Problem | CodeTikki