CT44531

Morgana Counts the marks

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Morgana runs the shed at the kelp forests of Tangledeep. Today the books show a list of marks, and the numbers must be worked out before sundown. Task: For every contiguous window of length k, print the maximum. Input format: First line: n and k. Second line: n integers. Output format: Print n-k+1 maxima space-separated. Constraints: 1 <= k <= n <= 4000; -10^9 <= a[i] <= 10^9.

Example 1:

Input: 326 231 554258369 -492923944 547097997 292647080 919947995 -159635113 755708971 804024469 -954244822 -325891836 -924905693 -729984822 534270916 -716858257 -783647707 393271502 871052373 -83638519 381596027 553578142 -90481305 314383126 -359380455 -351368824 -72767899 32226227 -564906555 -152609441 78861208 373162658 791657386 -503588412 261078060 -246820662 -60712586 850272387 -524839489 618128244 -721334219 409129029 386690362 753672300 -275848525 948247688 -469614728 -456837442 -704990611 74014243 -592256010 -793262186 471443037 574533735 -332299365 979166634 76236658 -441168468 417285366 -129663615 136778436 -842711202 886837768 655016830 913025435 34680044 -906374586 922385714 -148897295 -679726682 252858487 -411303330 481015726 969887432 -99391671 -236854372 -607842752 -628897726 -446…
Output: 979166634 979166634 979166634 979166634 979166634 979166634 979166634 979166634 979166634 979166634 979166634 979166634 979166634 979166634 979166634 979166634 979166634 979166634 979166634 979166634 979166634 979166634 979166634 979166634 979166634 979166634 979166634 979166634 979166634 979166634 979166634 979166634 979166634 979166634 979166634 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 982964237 …

Example 2:

Input: 3991 1660 956435940 849514064 -830508561 856223214 -889498599 -770676097 -997837725 -254013724 326893540 -435665239 -147652768 -962558746 -324238043 -807585566 803205273 540400027 -400977804 -476267831 -681096947 -894100179 -147099443 134100458 591710894 -525903980 55109719 -425485272 403070398 -545558086 584082799 -845578778 -127894692 -56146905 297490708 -848290737 -232720254 722408072 -890310340 485783509 -333717499 -296936284 142603374 721229469 -224376437 -559688788 187895509 -513671950 262280507 261241931 168673951 619790266 -448959238 -582289787 -112842991 96350885 490462475 523026039 -146651457 795389797 -978575791 -536313064 -605355801 804112970 -253819859 -620305150 995993485 -15338996 436617733 -410282299 -720276033 488485976 300912252 -31620047 -595414212 445843482 -434803214 3…
Output: 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 996461602 …

Example 3:

Input: 2772 2272 -265238906 -492412738 -997156538 98884487 445676094 305427979 710415006 36248596 -46043919 849524818 961711500 -370920752 -207398597 22768841 448453853 -536798122 -5516508 -775369349 -211249932 -987665144 -95599969 -915258881 -276207782 807483325 119318404 137088646 667286914 685542083 -353558889 -760660518 572292789 970184086 -94227771 760949003 936141203 -28449232 617948040 -222962932 631522787 880485131 -243246077 -428362776 691787808 -998768282 -538088585 418996335 955140724 763499780 -576652250 605304917 -333567708 -487081478 278223740 361446321 919443066 -156642047 -850380399 825217952 -533599960 70588096 116489847 -796764776 -305829108 -972021910 933678061 -899965305 -465400334 818327465 238611661 715237592 754649281 -900778633 -707891750 401577347 607933866 -720208101 -57…
Output: 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 999880009 …

Constraints:

1 <= k <= n <= 4000; -10^9 <= a[i] <= 10^9.

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