CT54076

Shimmering windows Tightest Stretch

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

In the seal rocks of Barking Cove, Trader the customs officer keeps careful count of the windows. Approve the repair estimates, every figure matters. 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 <= 1299; 1 <= a[i] <= 1000; 1 <= s <= 10^18.

Example 1:

Input: 13 3344 727 579 70 201 780 46 504 392 408 343 303 239 626
Output: 9

Example 2:

Input: 597 287961 180 845 42 451 996 161 900 746 843 759 450 65 160 630 525 285 519 229 649 261 828 591 193 90 723 736 739 764 405 77 917 451 509 929 241 82 242 707 56 82 37 534 709 677 193 155 882 800 942 878 858 469 302 892 535 816 802 127 406 874 825 569 996 928 527 7 23 351 242 97 140 187 610 617 23 790 612 416 700 796 355 687 890 643 518 226 77 344 409 364 707 123 826 127 487 359 389 22 770 162 960 3 545 203 186 557 645 667 875 439 275 801 630 114 476 475 459 530 460 860 509 183 872 444 217 611 498 369 253 766 593 271 648 803 183 633 827 594 359 632 934 591 127 167 1 507 56 204 643 669 143 246 983 870 604 636 789 650 868 708 401 161 268 893 398 765 722 958 314 966 20 484 462 455 7 815 957 923 745 859 686 426 991 362 495 953 907 35 860 174 229 712 725 3 35 242 856 980 63 639 92 383 971 628 52…
Output: 568

Example 3:

Input: 165 11224 126 185 905 490 174 349 558 824 471 611 803 714 296 916 571 268 208 78 206 151 860 430 351 24 528 164 472 895 997 398 197 715 90 293 803 574 61 484 592 636 213 269 978 635 150 898 990 66 920 366 116 671 598 286 584 952 637 601 880 559 94 864 956 105 979 976 326 395 535 35 789 477 833 40 433 130 94 675 198 254 903 263 204 270 820 865 336 774 747 640 488 69 536 496 173 310 644 396 771 267 681 450 116 919 758 774 168 810 562 603 877 832 881 12 696 464 340 291 96 959 225 934 542 181 920 545 552 413 432 902 631 22 68 864 56 607 717 842 744 487 779 560 185 5 980 53 845 582 721 381 767 887 72 437 174 309 433 142 10 829 505 300 590 387 10
Output: 19

Constraints:

1 <= n <= 1299; 1 <= a[i] <= 1000; 1 <= s <= 10^18.

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