CT44885

Hugo's panels Reckoning

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

It is audit day at the poppy fields of Scarlet Plain. Hugo spreads the panels records across the table and picks up a sharp pencil. 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 <= 2519; 1 <= a[i] <= 1000000; 1 <= s <= 10^18.

Example 1:

Input: 377 192241406 225070 424062 432581 933740 427076 958197 33221 931820 843719 968935 310715 56647 792199 215749 85506 206709 297514 152884 654297 841925 946176 503289 463926 771609 82429 381594 183210 771450 186232 672446 979423 890570 415399 875737 237096 334865 980327 511341 522811 322812 802323 21947 491821 315883 220205 418833 7997 484777 259370 944423 247331 997777 521758 366378 270385 218193 26853 754775 319701 160666 139301 272394 186125 208049 16705 736703 769890 686867 951238 788370 805301 894821 972038 831142 568033 293630 775699 930484 915888 938892 859706 166950 853536 767240 449507 954177 966718 491576 652374 512237 891462 693602 79731 905290 923659 973296 931048 909520 473719 662408 945709 99061 837188 113652 879499 551856 493450 16309 353145 242592 341264 931813 154588 684914 …
Output: 366

Example 2:

Input: 1386 326708439 342719 584352 918256 286164 975388 698127 461383 603408 961845 21022 961747 730096 342869 705521 191910 711796 151880 261018 59236 553322 964742 917370 897574 64875 933772 152334 638856 428822 911393 801462 325796 206175 401940 770729 346917 778040 48403 575995 814895 757140 70598 51425 489122 460387 902440 337118 9810 341975 564711 240634 575404 873492 937028 147659 519457 177921 704317 983893 847611 992701 659870 751146 341628 327548 636216 570786 241682 19297 737441 449878 741210 597241 226498 147424 958708 984774 807807 174870 86459 123954 200429 293550 649678 764314 35269 373355 392340 898596 34947 941311 174137 108367 322747 408686 411 8162 191240 194889 822746 283187 712994 236399 857736 187871 47515 803879 803307 632492 699287 90367 196491 198664 868582 858450 367180…
Output: 656

Example 3:

Input: 2054 97670679 535941 33059 758698 873355 230749 639589 56070 716736 141757 103480 296306 450329 635332 734938 285691 566402 721238 118977 572113 114869 303336 370753 266955 430533 295532 528332 406125 328156 169305 585055 671618 221213 108483 966766 120198 646859 88018 517031 717091 35940 807389 987798 582659 939206 966368 59710 776689 512643 130639 987830 563726 25336 251270 156291 979707 450524 428586 128199 702637 693250 316307 941669 243366 375593 530206 799371 126917 461782 322763 348190 805166 35035 975106 630120 651707 942694 4368 193936 837765 589190 793715 211632 574091 701417 745204 793332 199119 101403 606786 169740 664707 689650 341488 887918 519871 403690 60883 499735 668152 278160 642809 960227 316404 669113 497369 252289 153098 534665 444268 34015 806964 906274 454947 27623 …
Output: 175

Constraints:

1 <= n <= 2519; 1 <= a[i] <= 1000000; 1 <= s <= 10^18.

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