CT53696

Dusky windows Tightest Stretch

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

It is audit day at the glass towers of Prismhaven. Mina spreads the windows records across the table and picks up a sharp pencil. 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 <= 3372; 1 <= a[i] <= 1000000; 1 <= s <= 10^18.

Example 1:

Input: 2391 321497474 549184 878997 52013 888277 274919 967646 639346 234074 294996 943245 52101 795827 761163 945560 691485 642304 427344 615291 578043 444962 340364 9419 818736 5558 792811 3217 797811 304660 450855 879743 726439 254344 938090 393260 965330 900694 272918 139744 879505 897673 68051 104089 54050 671176 177534 560589 2219 670938 668713 971155 341877 583045 235978 391094 998341 516205 754259 849933 507725 149495 679936 837360 374876 359632 519286 402544 553400 343951 87631 801457 187717 856506 970972 396573 861058 606545 901594 832853 56076 611912 262838 809665 400652 924504 946313 755445 226313 518181 534874 562207 80231 743348 725747 991734 340226 127136 346744 767121 905591 474630 925542 913263 890190 809280 792872 433128 131271 744485 986524 493537 162622 575497 479538 742646 13…
Output: 628

Example 2:

Input: 448 51210238 308007 327280 886345 422428 12285 919848 120470 211392 103962 270142 272192 658405 234886 676407 59273 304172 782089 536993 752375 379848 216436 150277 818043 768335 742388 338688 979218 449666 171211 349526 789194 212408 965249 362614 175041 624295 692883 456697 655538 139042 347682 35119 655812 934092 955206 564005 710990 844219 760132 355541 172808 767695 772276 101331 649261 200199 62768 517622 726377 786616 729465 488253 643589 191517 332797 675018 522180 824938 416602 446400 389 544890 733582 962582 131023 256175 461562 247217 859594 389962 728889 657484 611717 128245 975181 793146 924602 242020 336505 337590 142340 515021 601780 695676 527967 908459 668078 908549 928550 91667 985246 634279 920447 996412 426161 82050 191125 140944 396599 81273 659063 367166 36158 676937 …
Output: 95

Example 3:

Input: 910 279989134 682205 744276 935663 137429 712180 489187 687512 417190 916891 143793 332496 785384 482361 260757 45167 480536 774730 659950 713874 770165 411108 45467 190649 467100 654539 135555 242688 958857 126814 105637 562305 495753 35332 795185 598718 277789 151627 439382 107258 343224 200129 166574 232284 251408 696322 302109 233888 801879 60969 451821 170279 901982 572416 421621 51975 981431 115628 723689 732367 460516 343746 95939 132895 878944 373159 146866 409308 497085 978003 570799 365324 811788 381344 728903 831328 442638 501655 261500 927114 7298 777703 774713 739808 135139 487725 467920 761819 814408 955274 934806 833180 633722 228794 194064 632865 383011 799838 21391 734964 51943 659350 756704 314855 463592 619665 493680 831781 178182 793306 880243 427584 239357 159547 10718…
Output: 537

Constraints:

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

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