CT41035

Eklavya's Tightest Stretch Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The council of the steppe camp of Horselord Plains pays by the answer, and Eklavya intends to earn it. First: the full register of windows. 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 <= 2562; 1 <= a[i] <= 1000; 1 <= s <= 10^18.

Example 1:

Input: 570 100314 166 116 150 63 181 981 286 195 600 650 55 792 193 831 895 64 55 236 572 767 884 402 195 579 496 799 575 700 548 928 265 570 6 621 270 235 385 69 840 104 871 8 344 140 613 592 374 96 822 516 656 176 886 74 687 365 448 579 980 601 532 159 341 453 415 625 849 799 757 815 919 664 967 419 430 57 448 45 632 514 658 636 949 843 29 834 184 970 729 335 388 280 908 433 234 241 928 125 900 854 536 578 872 153 420 204 290 858 503 763 61 950 643 70 410 628 459 528 826 854 679 664 598 187 704 926 769 646 858 830 594 16 676 999 685 478 435 721 698 592 920 525 474 717 572 756 59 103 472 394 709 797 659 965 197 734 478 962 123 97 818 242 875 551 212 463 78 598 994 41 850 996 816 863 342 552 412 924 28 465 159 538 507 422 474 463 536 695 81 301 696 347 699 290 43 785 401 588 876 849 682 595 222 6…
Output: 179

Example 2:

Input: 1080 226262 252 711 830 313 755 379 833 694 9 260 180 661 499 662 105 721 61 875 522 292 488 616 891 861 365 590 187 113 2 111 207 530 325 520 431 165 307 446 976 793 260 732 220 666 635 354 545 531 474 65 195 796 224 74 499 850 284 123 426 527 339 834 273 202 380 115 556 461 148 766 768 823 326 204 731 151 311 146 415 614 636 222 828 775 493 661 332 515 285 921 237 268 28 522 253 948 162 526 892 897 27 874 184 292 321 157 13 689 339 189 599 101 116 446 726 34 754 593 377 27 441 53 361 579 969 336 771 222 496 374 692 851 121 380 259 276 841 356 455 674 779 639 979 967 776 787 597 514 505 164 982 889 252 817 159 775 474 412 715 447 80 28 735 515 217 742 435 978 763 762 63 687 616 565 813 248 720 789 778 706 138 434 597 167 272 613 974 589 718 777 635 796 622 849 207 510 807 527 651 52 913 9…
Output: 453

Example 3:

Input: 1223 43600 137 371 960 186 171 30 147 606 36 883 644 27 815 775 527 434 107 729 558 655 837 125 482 721 584 940 574 46 146 24 873 807 274 481 701 871 198 187 267 66 61 162 562 695 33 321 323 108 828 894 92 752 983 235 785 869 725 736 601 565 918 868 227 413 914 971 642 610 912 643 904 80 280 266 461 323 120 365 499 526 682 687 340 693 367 4 790 624 290 598 350 726 211 994 273 574 268 567 386 727 643 914 103 676 990 965 331 69 220 259 995 858 558 686 937 768 443 840 641 607 478 372 764 828 50 271 586 362 813 11 666 178 662 18 96 330 754 183 508 55 787 674 326 848 640 270 188 227 30 274 184 244 446 53 813 664 70 919 58 683 594 162 424 780 312 164 767 335 519 273 793 119 270 827 324 675 750 48 819 715 499 402 579 129 494 69 314 97 184 815 592 250 868 512 21 772 453 336 616 612 379 1 891 750 4…
Output: 76

Constraints:

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

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