CT35284

The windows at Misthollow

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

It is audit day at the valley of Misthollow. Owen 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 <= 1202; 1 <= a[i] <= 1000000000; 1 <= s <= 10^18.

Example 1:

Input: 1072 63315335882 312139581 938138895 379201366 906932057 37425871 558825562 637687854 833884044 574124020 942530715 801812944 45352069 86325264 173269603 137783437 102141356 41641968 382948479 580046916 115668599 88592052 253590723 758108467 862906514 958275268 825166867 868741467 851347442 676372345 590134612 922070577 536162620 24663877 672285655 305787008 994800526 743576325 269748495 641786726 308716608 680011694 401152801 886881317 867932635 943519279 434209539 4128189 753006178 608916827 710434497 918297557 329850215 795165012 565897821 341245224 311335200 216461461 225333515 62018034 332596094 337922532 397754182 684205629 459188144 966711836 912604631 360447939 140465998 934966756 106111611 240428114 671924585 344508287 755520413 13076581 25705650 115543959 16671871 856261512 65697…
Output: 105

Example 2:

Input: 802 130933275352 315100187 633047191 845728699 241640064 109812862 616360667 467230023 223334900 401971021 673438846 721742696 245723233 167875810 381448159 812306238 894522633 522348940 809798024 512449098 566761119 241294499 36885990 148489978 17961798 234262674 273884275 184041019 615948560 914814062 248773219 117915674 105927239 316400609 196877762 455670455 37886723 996488370 154851664 605059840 882805473 911403628 455892492 254696311 586153016 33065246 223982288 328468376 902225061 701617352 243941245 760518488 380400026 636398660 835999533 280866565 731888827 109415257 395847825 442085425 88594641 721019184 691606769 896021140 15725448 962800579 346811590 374080992 721247295 936406583 857201284 364948957 244338164 13949724 131338775 469752426 550763286 483802913 556946502 274530211 …
Output: 246

Example 3:

Input: 1073 475631006765 975212236 134185231 789484838 624371399 179163802 534904055 933431462 160324273 777721789 850229204 443795724 820166700 360234974 598282928 408399607 345928690 13824322 45002421 121762462 93114946 952056353 279528735 659234571 328309050 297560065 94737573 978339597 421511301 741626408 729048619 118112767 409108317 769223614 91774835 991051042 29045488 920281121 887030518 551168919 344227376 243825478 566790116 313756594 220939565 348399848 563402678 250588914 332111261 542807130 446829097 634950944 806958071 89902025 470285496 19282918 679466552 45403888 271838425 956102959 445078456 295407102 252732416 401635694 977490507 719845479 461751500 139076302 99093778 408098345 103258034 528773373 975588952 935047366 266103933 129296473 641840627 75193365 71093598 807700606 7015…
Output: 962

Constraints:

1 <= n <= 1202; 1 <= a[i] <= 1000000000; 1 <= s <= 10^18.

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