CT42739

Theron's windows Reckoning

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Before the gates of the beacon hill of Lantern Tor close for winter, Theron must finish the windows ledger - one figure at a time. 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 <= 2711; 1 <= a[i] <= 1000000; 1 <= s <= 10^18.

Example 1:

Input: 706 154527147 397251 865101 654912 340526 989383 355195 381731 812955 954597 395766 143404 582329 751573 730759 295164 790770 673047 844903 718349 944918 438208 263646 855226 286539 48420 688518 538581 327250 464838 148194 305211 181811 286134 995298 743442 550750 253808 614658 310815 431427 619158 822543 669905 538207 680800 172531 27091 898165 488012 245237 658329 830558 948333 721377 837630 438892 717523 14682 169835 112207 842045 359445 75936 715508 37888 143430 286711 98185 703631 645726 936081 206216 725936 436351 126131 325268 307163 129889 166141 492650 264367 478390 661446 937155 942610 314986 346242 690528 74183 844935 203414 945001 227652 669089 656360 74673 827624 342837 810200 76374 623475 864938 617388 475675 816604 666052 692894 580090 518276 729991 418249 540515 296220 7296…
Output: 291

Example 2:

Input: 153 27888676 113998 556601 182377 242043 963332 67710 324755 335436 7480 432979 365023 248820 803067 513949 140716 857524 723395 163068 664766 413902 697339 802076 761432 746893 428510 422546 669395 995702 161812 887560 742879 369102 765094 115671 287295 375331 23267 288875 785829 279876 930484 292583 721135 162256 85804 183683 155955 178737 841751 507246 149400 380107 602822 867868 543988 167114 120504 136792 713808 933693 766489 556326 437949 778202 154032 650529 746809 566493 391505 114313 697613 490360 406441 935944 270194 391469 258079 238159 93813 991182 758996 87283 644076 157206 295767 183289 444660 971556 406168 928466 181322 556234 699249 294956 996386 237062 603862 895292 191148 148022 299512 109040 264345 143381 874446 171272 59286 834065 728748 406999 27052 948889 711181 74387…
Output: 53

Example 3:

Input: 2566 1101919655 289614 896461 638531 33611 70144 71527 862816 983292 117626 626460 33177 727472 408780 843265 943469 346388 931940 411135 19317 178362 631825 933276 540729 989877 943549 96140 860153 995075 673309 209323 791 649857 839743 787606 412440 830201 869464 616825 665083 798193 326737 834590 270463 762615 169459 233397 452859 766844 882103 261480 129571 724709 781229 662075 804462 203851 973274 279955 319643 681019 800413 981707 335522 507420 421088 227914 335992 784637 347206 126292 592009 950311 695736 563548 653169 153960 143342 653471 392495 693347 773433 593955 870588 940167 730712 778267 932786 753063 822529 764563 972009 277863 187195 172003 236211 538851 9443 224769 677230 206410 757166 239848 99360 159863 303351 305549 119400 599290 587703 729451 898252 44449 890250 276579…
Output: 2185

Constraints:

1 <= n <= 2711; 1 <= a[i] <= 1000000; 1 <= s <= 10^18.

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