CT42717

The Bluehollow Tightest Stretch

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Deep in the indigo vats of Bluehollow, Fletcher studies rows of ribbons entries. One clean number will settle the guild's oldest argument. 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 <= 2316; 1 <= a[i] <= 1000000000; 1 <= s <= 10^18.

Example 1:

Input: 1502 223315197522 584746325 610278753 181127343 466918295 289737364 266817955 119845168 554748282 578387079 974645110 427979234 28284672 158316131 800531730 626926044 174691023 797392724 393910095 633197885 839975622 974260027 700313394 288874102 518759127 54002775 607790986 560519064 692445313 812416761 927877065 792458333 531081277 293667948 423272355 38371200 750634547 21804350 530599308 507591698 935607890 698688866 32044901 281941382 273803322 213060956 675275041 404925111 451138989 669550928 816175339 637411052 169716471 91423278 312622760 506728582 762699258 787662101 366288721 457823118 641617312 980800096 290318023 878111097 219885960 76800275 966138932 564392301 561271077 945643391 164524070 962554370 379361994 687042833 713466560 210936479 653825744 448995717 20277913 100244074 …
Output: 429

Example 2:

Input: 288 51094672784 204433086 876375601 283258443 542021402 227164312 546509087 422471204 350279651 650026534 514027096 907611856 832876714 863173514 145732955 961066416 741934202 909665524 365959292 371195496 26693375 719673159 409257992 920482404 430232015 500371365 131985223 456268795 814814974 744233008 433547220 519450756 473679875 728052530 239822625 240641865 81945793 743455110 718421756 976590333 905668881 463668060 202051853 814725411 435659899 731364963 783862636 508728628 638011709 948848204 785287996 659454573 977992300 850605636 114601589 664080138 388584265 42613013 740037572 438348816 401196083 770541293 312445158 977641532 611433883 345129072 761381826 327059744 997895752 627915991 823467126 994034130 918701347 347241396 172259091 538477670 840565061 897415117 585924678 9020929…
Output: 84

Example 3:

Input: 852 38201272336 137911052 938892051 41858586 508872938 675306158 839568550 737509056 317079429 517690320 729879771 376771102 936568736 537672497 439920381 223331160 155505495 254657091 953466951 430750623 255835743 95202126 883692621 678524372 868828222 532248740 902358636 381147053 583684732 234471579 833407041 959730500 1114353 131272451 874112963 42792683 623784146 724756336 460015633 367093182 913157657 584037988 910756013 482016405 315880235 48608855 930074391 831326654 553565351 296537938 166749485 754534131 950921578 11829236 630846607 907681935 266022632 394473691 244115728 701762039 952588791 788902135 222170944 554279620 478013126 156984835 404925217 914210988 797800235 30057441 678707537 481486162 509469794 148883938 579239269 108631735 853421075 516715045 166389325 553359045 21…
Output: 63

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Bluehollow Tightest Stretch - MEDIUM Coding Problem | CodeTikki