CT53064

Zara's Celestial Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Every season at the cinnabar mines of Vermilion, someone must track down a clerical error. This year the task falls to Zara, armed only with the ribbons register. 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 <= 2809; 1 <= a[i] <= 1000000000; 1 <= s <= 10^18.

Example 1:

Input: 2675 1224131475807 662206757 673505353 752961769 925484325 324523222 814532959 499244877 666112100 731207781 152376432 253009228 834305229 269700391 502006049 924310227 424323629 960570484 4273279 578083766 811939649 760674102 309229563 765072008 662572619 179500897 618128221 922095233 245830300 604878667 781571512 355558765 751403571 319314374 538087437 434474469 196290534 680421984 699569719 454054834 932298425 419569133 582593220 215653848 741636388 467336107 400528734 800670057 766840949 524188623 721529520 531093071 1356667 725172002 556856722 617374884 473271017 432139396 666233216 277999145 50167866 213440208 666422182 101684566 634057113 922945681 359365525 515145944 917644202 231289455 711537517 716293467 636502317 713395276 225846742 342687770 836987810 195435610 469235974 983737…
Output: 2481

Example 2:

Input: 2743 341930353132 315406641 578310084 988540958 116612529 336579469 646552692 962018160 391525563 974136949 317148886 102074117 578364819 415103375 853311473 745609540 879547679 427203486 275662410 422352735 692053583 270949929 193174413 314451575 775557787 694302107 282412094 209237391 177846654 133435216 99541892 796123661 39377674 72263521 973379416 894708798 846125694 683259325 760412749 195060279 569161113 84566859 893069106 213766929 38959374 323414710 342259362 475246898 915173949 577270200 66357399 992848711 373668478 691716105 346392652 895131854 253454218 313391460 695904813 593534768 262267959 676143266 950836010 967443058 391700298 39939030 123573013 145613651 238048706 136719178 585787184 948352794 922110476 155874352 174571349 145079834 793246423 218471947 29237828 856622423 …
Output: 662

Example 3:

Input: 955 234386031333 676166145 280826653 578185791 838213304 775413690 638744319 130893419 283409689 226136707 604845818 820216227 56863547 478014301 551323106 973640761 150325404 250743968 792355505 3135841 302023965 611485018 346326667 583194684 213226292 858964751 971609072 528552230 647478537 136451138 469221790 940208556 468060683 892004727 985293510 566590486 705363087 929636363 455776704 21390830 322984321 177384010 964892562 710500196 846764095 732597720 61535661 102229453 277358044 750818514 894221726 805848333 766131690 994914098 805784250 903553099 105540824 335734362 501903219 322697946 968375833 888699138 611278849 519093561 311138908 800120392 148084145 557568719 631758852 619364253 219589503 332901127 601410784 904849503 473141791 384281326 50479870 467032609 918833447 456070690…
Output: 460

Constraints:

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

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