CT35190

The windows at Verdantstep

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The council of the bamboo terraces of Verdantstep pays by the answer, and Aldo 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 <= 2259; 1 <= a[i] <= 1000; 1 <= s <= 10^18.

Example 1:

Input: 1538 101533 869 848 311 832 705 404 166 811 936 781 786 850 25 921 849 884 565 604 912 697 836 685 212 718 891 26 163 85 895 538 404 159 187 630 795 382 621 516 689 305 457 534 966 211 434 680 962 52 711 588 30 227 220 110 657 719 518 937 713 412 479 336 665 671 294 746 675 663 556 505 214 567 554 85 894 450 821 465 204 375 328 521 46 344 946 986 35 637 964 326 805 754 966 633 861 228 401 645 205 106 557 993 235 714 527 506 142 154 889 374 343 759 143 202 926 605 448 674 932 251 418 625 788 550 157 269 370 998 505 235 484 982 947 858 187 620 616 227 803 591 10 702 191 55 643 307 482 862 762 496 202 846 441 482 960 329 371 952 344 389 559 98 409 921 132 118 83 653 356 941 89 266 266 704 539 384 430 569 666 733 352 364 625 651 830 235 989 287 30 470 296 204 587 558 141 224 592 831 618 502 42…
Output: 187

Example 2:

Input: 1269 238620 36 844 781 826 790 304 292 371 695 922 536 580 162 555 33 25 713 278 617 818 987 269 508 682 31 145 177 999 501 553 367 727 880 365 73 998 599 345 200 298 736 784 235 435 849 167 339 556 288 549 362 791 304 605 303 395 533 889 864 545 70 939 677 982 523 344 664 19 951 932 84 145 130 320 699 989 428 497 153 269 607 66 552 418 305 887 876 785 130 248 557 337 590 115 774 660 918 230 834 986 293 791 138 433 625 120 602 847 22 927 910 529 816 238 849 999 468 306 524 198 72 712 975 75 564 498 427 868 138 454 620 930 419 456 459 207 980 978 396 320 237 347 55 774 245 631 108 66 346 84 235 591 7 935 477 700 588 156 804 886 221 109 727 510 104 33 798 636 723 205 755 681 602 638 345 328 698 81 46 177 538 420 883 742 849 929 461 228 909 343 53 717 215 457 40 695 952 777 977 309 448 112 32…
Output: 448

Example 3:

Input: 680 98241 585 657 677 227 700 59 422 720 23 201 181 223 353 278 792 571 153 829 559 581 554 446 581 648 458 473 153 943 257 336 825 934 677 968 886 748 807 307 681 165 498 995 836 314 809 711 937 707 578 347 885 389 835 366 560 950 471 795 789 796 383 349 829 742 714 827 946 333 622 195 557 373 688 249 231 264 591 794 700 220 24 381 934 887 960 169 494 12 802 367 908 941 806 534 486 17 946 915 962 454 442 552 541 40 660 545 647 348 283 96 400 952 918 844 169 849 795 108 195 206 247 251 918 804 754 328 30 363 657 486 996 626 424 815 112 398 711 38 122 554 589 726 867 987 384 522 223 677 569 182 973 741 960 88 715 315 849 810 951 866 805 933 406 602 848 542 142 257 276 207 173 424 526 671 356 507 337 453 629 630 828 67 606 168 684 353 904 367 246 509 947 213 906 380 978 669 410 979 494 258 8…
Output: 174

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The windows at Verdantstep - MEDIUM Coding Problem | CodeTikki