CT44560

The Shimmering stretches of Nico

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Nico the auditor watches over the spice bazaar of Saffronia's stores of stretches. A careful computation stands between order and chaos. 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 <= 2859; 1 <= a[i] <= 1000; 1 <= s <= 10^18.

Example 1:

Input: 947 302168 467 213 309 395 848 584 837 879 17 669 411 700 393 555 15 498 660 219 727 548 690 476 662 486 417 402 643 406 244 747 41 308 996 37 982 62 545 470 153 524 838 551 573 609 729 434 172 332 506 167 894 600 193 583 600 727 265 329 555 826 706 866 850 233 813 503 366 787 7 434 504 743 111 630 508 861 642 290 976 335 797 37 7 892 761 447 806 425 840 903 381 70 628 426 177 191 856 917 740 830 968 831 368 960 592 870 180 513 436 179 234 885 290 983 350 338 474 762 97 408 674 364 588 225 187 601 760 30 211 319 736 387 550 961 98 455 421 167 88 215 612 376 60 603 844 74 107 428 186 820 911 559 902 517 744 170 847 106 42 657 724 757 282 178 934 216 277 303 376 784 675 245 345 314 545 188 485 287 949 707 155 66 315 41 57 511 17 946 636 890 356 817 661 783 191 557 387 969 929 446 626 353 632…
Output: 589

Example 2:

Input: 1582 545643 569 77 188 430 581 342 594 86 99 744 81 307 550 675 741 466 716 781 742 30 122 784 854 609 943 381 849 341 864 126 312 561 392 633 194 941 602 852 270 704 888 750 383 730 68 922 22 575 377 217 311 117 581 723 835 309 100 593 602 154 798 347 973 850 331 504 868 859 845 31 504 663 525 718 600 767 641 635 986 936 436 797 741 663 192 267 889 237 748 713 455 257 733 372 807 129 106 109 815 337 952 598 166 320 35 225 366 124 192 518 267 307 878 532 162 405 543 108 263 576 250 174 634 485 242 381 861 708 38 271 927 252 766 460 660 133 660 415 99 331 987 74 912 126 756 286 683 488 127 798 631 129 26 459 697 507 283 213 919 212 366 166 653 634 302 274 72 352 606 847 622 270 370 943 17 861 829 623 349 331 521 219 753 574 470 885 708 122 416 713 569 554 792 417 717 745 118 725 613 880 117…
Output: 1094

Example 3:

Input: 2311 459571 349 637 607 201 139 738 237 364 4 102 456 65 379 955 651 112 389 419 81 900 638 575 445 111 770 224 678 136 838 233 32 923 943 662 54 310 851 31 756 88 793 514 965 962 505 796 946 124 267 90 674 361 544 269 954 216 379 544 872 991 791 936 829 945 879 177 160 974 241 536 222 115 716 332 301 871 307 382 967 431 692 907 518 444 701 569 130 597 879 703 718 850 412 346 921 641 525 67 412 506 555 757 225 748 997 557 495 483 751 878 611 736 856 825 101 685 559 943 494 336 145 603 143 751 296 469 414 729 415 605 856 583 310 884 346 377 329 538 35 718 643 895 558 318 118 835 618 456 633 712 361 396 980 510 167 986 279 215 279 571 773 229 965 887 988 131 355 100 408 384 71 592 791 520 39 181 471 745 797 787 382 524 233 894 838 896 590 693 306 23 933 624 925 816 642 577 584 256 554 454 52…
Output: 890

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Shimmering stretches of Nico - MEDIUM Coding Problem | CodeTikki