CT48018

Gardener's Obsidian panels

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The council of the lakeside town of Mirrormere pays by the answer, and Gardener intends to earn it. First: the full register of panels. 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 <= 1076; 1 <= a[i] <= 1000000000; 1 <= s <= 10^18.

Example 1:

Input: 418 211304290624 586303803 70400319 25501950 253353401 90140898 174821242 601665429 458888216 27872792 141433822 82328483 629779860 847985747 582891715 748244389 426799385 949381542 863223012 848616278 238500616 391137274 657619343 722837820 115791589 59875897 673709068 71863163 565703557 142389181 422281298 448863264 33122023 957448679 839537480 849532139 3755957 418393289 661277739 946943353 664564294 818388370 45715299 232984244 868670229 542296676 245910184 897335559 117767271 755173593 745100198 801556130 183194122 563680584 306288517 745011026 190543606 445866271 310225153 714237819 574484903 304082815 628453937 808480793 107347591 347677348 711457379 772760619 858085673 586948919 123958782 123438245 636958610 299411663 465118778 136776225 345876578 237553070 388389706 21570547 26274…
Output: 404

Example 2:

Input: 27 11011100388 887668482 2958399 10761661 579860007 143569081 726830940 225775643 266915585 736790352 461239276 258056795 951865063 451174765 932247527 118224568 447402601 427779250 171620669 714636912 822067011 815708325 224704735 213277754 599394530 807674670 439989940 927092234
Output: 21

Example 3:

Input: 1066 317441580162 509669360 530580365 578718204 575493152 791005825 961350308 584913806 75096578 650953064 500999545 745490445 988713712 297236314 655731706 426620276 375479750 543559769 792589311 789159301 783319371 681669860 311453942 609567497 104359164 855713261 898755962 767931704 7538541 255483861 283396762 52214086 31022898 118569412 718751735 126906484 45476424 194293992 277702170 587502540 241243256 617952515 34738274 509346891 855019843 341498900 805765673 276107195 165834109 560844652 143196386 60793759 693993577 931065850 340938650 986695402 424420001 965821767 509684097 284261273 395232939 894607441 654441517 107308714 676551555 321586790 253510861 452878409 743548784 877683333 570420461 181613403 427831034 84817406 755505032 100674264 567149781 456069040 400523522 351279094 6…
Output: 624

Constraints:

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

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