CT48927

Yami and the Woven stretches

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The council of the valley of Misthollow pays by the answer, and Yami intends to earn it. First: the full register of stretches. 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 <= 3707; 1 <= a[i] <= 1000000000; 1 <= s <= 10^18.

Example 1:

Input: 1848 338458726165 216359396 693321776 390232420 976700603 563334604 778464199 246140205 9926638 841402716 899694716 988686351 841430813 557149260 983330098 190420522 942473504 619133768 87813536 694000765 489887210 240710313 48156687 56489418 614877354 808681978 40480003 218943377 964027979 718112280 630745480 5833419 352084613 929070119 974448389 693338751 777775731 914733749 760780266 907204876 957542795 554358888 521638056 477949504 428768664 366700685 888577445 454723206 87399336 218565082 234390765 503410835 497498650 797702218 828836083 780090524 173875616 823766523 897729531 389989880 360509961 702211617 884489860 534065910 255479561 759498538 418431398 81034732 457869819 70493211 99935440 647932382 830588738 995318671 409996141 619081087 725680601 454255478 709338394 5278439 149010…
Output: 659

Example 2:

Input: 327 9455794705 87062457 727862938 95207080 35621581 451075289 468393180 862528274 250934624 145460974 48435983 880017813 770277432 919948312 113534665 395086687 407103184 613342284 185456670 75977433 311013750 397061254 725572659 958039410 529083229 254333166 977165766 961439341 735386288 690923087 875022256 448395374 110331357 371288218 636169044 486163577 758481807 883990324 1115992 453683911 82536401 177510683 99815206 79218825 32104435 676893293 393444414 723945631 230707214 570992803 812990556 13582 75758477 577561421 821271147 175314480 457286040 438006583 334516805 158505724 323271537 219333680 209898143 972099325 370886111 786025474 364859316 71144620 207915896 835258722 728063403 717931398 63326603 128677693 759044404 464057875 64215703 675541515 566569093 860129924 223850686 4636…
Output: 13

Example 3:

Input: 2192 92161636916 358598721 866917721 850426520 792442872 405817583 107423392 272304180 484860797 985758699 523514104 34572328 134347602 557136600 240597885 466189541 823749834 837494151 899095535 406399070 500472815 866719866 295351339 766773335 636169034 118468636 527069489 505667315 600550320 92977165 494136482 553758391 780238589 791922565 688270371 866526248 789843667 635716131 902626485 885731898 102599600 617555733 901712242 599645809 839586937 510599343 146196516 41353954 34612401 428366968 654670979 751999907 512472215 471306853 740288947 123491864 133098888 258014551 88323835 457588156 196573505 548659612 770245319 546579653 212281907 1943172 507158702 808830975 857959191 984448692 674157729 430623713 633884940 880033619 238107781 761389963 585637708 484606529 69223925 713238904 8…
Output: 167

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Yami and the Woven stretches - MEDIUM Coding Problem | CodeTikki