CT44034

Ojas's Verdant Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Ojas the quartermaster watches over the kelp forests of Tangledeep's stores of segments. A careful computation stands between order and chaos. 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 <= 1468; 1 <= a[i] <= 1000000000; 1 <= s <= 10^18.

Example 1:

Input: 160 72624874045 763714841 694348185 6910904 121392742 428292591 873157915 138338900 521446414 460159294 196067390 340285239 86083166 189507741 136623423 818062767 377668933 444431893 185976742 325174259 241239884 614691287 475864300 146732693 437704406 23960867 939572016 463015324 841686029 444036982 612795503 462674411 612133447 193444467 807116828 486441676 239506261 230096927 10655106 879084709 132088177 868276998 507882198 996265338 279665159 873355240 95130715 323758736 312767645 228933099 309531498 724015195 482997417 177170877 260292698 557163268 99931376 416357785 265485540 42951140 805964705 534656829 523791943 283001458 452193023 812205852 128891057 193140962 300146469 594512943 772021416 608174687 528149982 760670615 49667903 891985743 536255891 369660072 976696167 630641259 298…
Output: 146

Example 2:

Input: 1078 180803589328 99934496 741687537 548481261 473700870 454267158 688298377 531038898 307638714 944980379 769666928 794291422 996801013 436574963 340776583 758508967 763457836 322466527 666367201 3136415 421474790 474911713 594528134 397205479 85568817 184893654 184372152 453877160 48221928 126025488 819221619 842022634 597312964 277701335 466436229 428575050 459242727 956881340 414414604 666067865 774035218 741136899 265948299 360297760 692150198 418714480 322180194 122423485 940668104 797395062 456748708 983549168 577612144 733418451 865890730 898047571 290785493 342744451 820839931 839074562 680620691 25591468 868521092 286826895 105319401 179685808 756084435 323379245 635755671 2991840 619096459 867709733 669414668 594528088 108222233 399963928 67856737 599748750 786066212 527306589 7…
Output: 337

Example 3:

Input: 1206 514924465157 986731947 684269705 667431140 438783648 766791149 977954897 670447426 250820335 716137818 554339196 669410807 126517605 979741445 746799929 179764651 987449851 936091526 638397856 82871065 787577778 543815594 669973528 612428858 443558463 426888819 871163868 718503541 729860814 475799140 814030915 327188498 633119858 909630039 5969684 665482430 86490482 873086842 515450533 101163632 68781517 984103642 173804076 755167681 267383776 642732707 833900310 292816641 121481565 53822170 659463666 550540481 306929572 348201147 958546660 704125467 454458316 540116458 255861597 865785837 99526212 667519613 293783225 119989649 839459385 270100524 986951840 918118372 503076107 965750792 752346473 227050359 324439050 574595568 288531218 455918385 421664266 442779021 395238163 146805445…
Output: 1023

Constraints:

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

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