CT37327

Iker's stretches Reckoning

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Iker runs the ferry office at the otter slides of Sleekwater. Today the books show a list of stretches, and the numbers must be worked out before sundown. 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 <= 1855; 1 <= a[i] <= 1000000000; 1 <= s <= 10^18.

Example 1:

Input: 103 13526226326 64484403 290548420 191187468 333127002 694951676 480724888 927222225 88583742 262170298 61687577 846865916 763874391 941240404 282634340 471728547 39546013 729016860 522097209 754376125 384916301 33106171 49407208 233978086 229763816 507632081 846755288 500830890 74649257 179212520 556172594 824932061 777716147 397856767 111506398 943999775 984638718 310825092 989337443 8760598 790590095 467156824 664036142 436417818 658661118 690900325 884637928 983235452 72253395 584271430 498384898 103226160 508746419 136561864 998779338 395218667 139159794 867337960 299534335 554747137 128922414 309954115 530710897 808359054 284163353 918916724 192131004 831904745 315553587 182532471 172474318 372857086 968976946 731246460 681246133 45798705 584027893 357787558 17167109 746888759 700962…
Output: 23

Example 2:

Input: 146 45725016153 881529228 343849962 626687575 405679659 291328747 54382030 414496255 862385789 196594947 896158676 938029476 419083483 475363978 276566217 836253169 367923480 832055874 431801857 91752155 347911014 535542398 469836365 451128306 568749063 939927784 70078742 976721482 690418200 957684110 861762742 847914221 512025015 192859932 249188817 750375346 424372137 749202552 596070077 520126058 120133278 83500608 91556081 582121365 404525312 832673101 677493603 289339316 831110481 762521601 99479725 825573469 929497197 296324835 279563858 186029538 773739913 875632151 128564893 988316585 540952574 237479967 538031786 548177605 528477677 644801108 234653992 723996655 832068861 403176620 573761728 350402311 560508508 364606033 939373792 604693382 793182471 222552139 934628612 81029168 4…
Output: 88

Example 3:

Input: 742 137895809425 128956751 574012405 360374570 805919726 894373198 897109972 140579383 495416083 673704018 181097027 223856231 851844702 823679101 55362541 152276170 832127976 872582771 670633605 761547948 579224243 736011550 321897328 594522469 89498274 403612511 527988803 283204531 286775807 572444462 995464605 137058618 338078498 368428979 746180060 297093469 290840592 629599751 807993536 251779570 517199661 939543042 888567363 305730453 609561852 631981560 614837887 998629803 380457655 817840824 664961822 343078747 345489853 811391373 531004930 769396925 750996390 925106272 62667794 135847158 647751590 429726760 307099022 646166813 112044276 28896914 328114637 72695377 719949894 639613001 273765506 601128715 519225366 32511837 18146054 881021324 153049832 152444674 818200574 944860352 …
Output: 267

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Iker's stretches Reckoning - MEDIUM Coding Problem | CodeTikki