CT51852

Cobbler's Tightest Stretch Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

It is audit day at the moonlit lagoon of Selene. Cobbler spreads the panels records across the table and picks up a sharp pencil. 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 <= 1034; 1 <= a[i] <= 1000000000; 1 <= s <= 10^18.

Example 1:

Input: 886 242992120561 622046593 442959230 938266113 155087543 999354856 331317692 225171013 49689547 642763474 243073520 947462144 309338503 802385363 62003993 417240749 423601008 519775531 540704252 579042423 254288932 110138767 41910874 578699536 13845955 94063393 109890964 260984647 176495213 876479266 876282017 824784281 163748760 571058080 768563362 675670297 575988714 720413259 868401956 770365836 835566883 55325730 852394463 341622997 728629597 103718017 287907948 851818497 594403423 133827800 406786310 414183098 656186475 307311132 162819280 460446649 222021125 115728200 968711948 794557182 918829166 851197825 636743098 418317813 565873083 375747110 520265364 216744842 252536648 985471835 946934185 629540384 815354375 166542216 684280000 146790544 632294979 207804677 585138061 238338868…
Output: 468

Example 2:

Input: 516 31120664064 166660382 429913025 336879051 851406573 693668281 707620906 706057473 708754848 782924914 419601975 954453639 79180907 203937044 595260857 495022397 471096549 823379786 193733081 27723087 82803871 376188479 248432105 286782196 277518693 965474464 801519437 361499217 704364330 385709054 758194357 135082567 454810052 266480112 568874363 260868565 223765541 658398631 167088782 447285397 132769266 189261768 423716399 596836061 792013327 294019188 815525202 589636070 323561712 397508397 20944555 673140939 450104797 689754749 3662520 269564770 300319928 710972616 376493346 594150943 143592259 405983569 915721504 890671107 687657370 784641932 122996955 732523804 266201038 511631565 481341110 116473508 803789618 971692166 230789973 461300585 887280848 379460790 311623585 17047248 2…
Output: 56

Example 3:

Input: 599 263841690248 544669208 635624773 230415316 64049612 963951033 331741464 744858119 312067677 8779316 999947051 181890597 374348614 959775229 260899703 705695719 214248236 871731981 441348534 554849945 942205384 569819774 825487163 941923969 907823785 882955595 618738892 830273849 987573318 383307547 508457926 175282111 973805782 662019982 444181573 744216049 174197452 137594382 203991395 46538382 152969625 915329105 105046599 46604842 767607869 266240972 692114994 115116591 122897344 301673208 957785276 48291799 631041412 313158208 350871432 345558331 394755078 663882572 248575559 98636809 29101641 65923499 774100724 768895456 707993517 321056903 386669167 830231885 72402929 43627304 762017372 561889629 620357229 674039322 605325262 986746426 573905754 672942072 686182086 96014745 45373…
Output: 536

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Cobbler's Tightest Stretch Ledger - MEDIUM Coding Problem | CodeTikki