CT43452

Cora's scrolls Reckoning

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Cora the customs officer watches over the ribbon falls of Cascade Vale's stores of scrolls. 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 <= 1659; 1 <= a[i] <= 1000; 1 <= s <= 10^18.

Example 1:

Input: 1382 578364 739 773 928 973 649 726 508 67 402 811 941 570 122 626 355 787 746 877 704 733 645 150 688 816 887 247 828 928 927 759 360 262 415 774 980 516 934 913 598 762 636 77 215 118 437 345 549 42 975 933 852 6 831 527 238 296 772 303 852 616 213 876 96 825 584 665 643 871 431 122 126 811 247 82 693 555 862 75 896 884 101 287 645 76 165 144 607 215 339 624 826 502 220 883 798 729 66 437 301 269 152 595 888 125 905 435 137 734 155 833 529 154 70 816 570 461 237 220 508 31 529 341 863 124 9 557 893 164 499 674 370 10 600 524 172 513 782 25 319 253 372 13 108 955 710 790 715 153 600 328 213 538 980 739 547 32 809 640 204 660 428 453 914 975 40 247 742 547 721 847 5 992 542 403 101 272 147 536 899 210 297 842 920 860 400 561 405 448 216 973 914 489 73 856 659 681 203 939 621 532 323 893 84…
Output: 1121

Example 2:

Input: 714 257281 436 357 566 457 947 962 699 245 644 263 50 328 55 922 967 417 914 45 94 747 239 428 838 539 455 4 709 787 340 694 689 89 106 931 631 284 18 596 518 641 694 303 236 575 684 971 187 572 313 793 313 443 719 311 949 55 531 575 593 994 349 907 825 324 106 543 510 445 890 225 951 38 539 783 557 7 764 114 971 45 65 967 7 318 685 974 120 384 151 806 214 438 971 609 570 102 878 951 705 722 367 736 925 492 53 376 790 668 828 160 354 161 667 985 612 427 532 395 154 287 982 281 489 909 245 900 774 612 977 30 968 323 205 146 78 111 682 468 206 44 36 844 943 924 230 239 497 767 928 84 70 428 421 240 337 299 531 175 978 73 85 836 596 697 696 776 35 645 584 273 198 57 563 865 795 36 538 959 631 908 846 739 778 893 487 435 368 104 93 73 239 378 44 712 116 102 892 649 415 365 484 173 233 14 971 7…
Output: 509

Example 3:

Input: 958 216145 56 774 655 502 959 236 242 568 572 501 715 444 209 856 632 980 333 355 708 712 232 547 82 506 712 722 579 59 590 928 12 7 847 148 588 752 657 399 735 936 847 210 744 313 126 678 564 86 250 803 358 861 692 967 89 156 870 444 26 465 362 745 371 95 857 14 90 420 554 690 269 978 969 936 621 853 57 351 192 157 916 241 710 746 473 804 832 185 820 343 727 13 420 391 276 536 38 660 979 702 279 313 181 886 171 558 679 617 63 881 536 153 260 579 919 937 522 571 202 535 65 445 107 736 650 152 831 787 59 56 787 476 60 112 746 710 541 213 766 271 479 367 787 825 610 284 394 559 14 187 288 966 774 502 246 379 604 736 382 871 461 898 358 49 718 542 117 97 548 364 650 827 715 646 198 677 827 725 566 20 379 9 654 972 294 208 815 871 919 251 537 435 577 752 512 221 36 572 491 603 184 610 604 27 9…
Output: 417

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Cora's scrolls Reckoning - MEDIUM Coding Problem | CodeTikki