CT61191

The Peculiar beacons of Tina

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Every season at the heron rookery of Longlegs, someone must optimize the storeroom layout. This year the task falls to Tina, armed only with the beacons register. 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: 1694 1108 -515827070 196085368 -406903441 -477076088 -247360014 480886903 804022815 -47152950 315199020 492265361 -441930447 732597655 -941653464 587228645 -478285328 688666596 239588895 984810802 -500402241 314020080 747298998 -130311293 -636462183 -471897620 -709480049 585349695 -728122160 548141893 766345547 -814675154 -351380414 729022360 -357530140 687132648 476956119 177946877 165696932 -223193530 -254819701 620037456 573006437 -98114126 -712561792 776041677 -448619095 -929072936 -957186271 281422027 806782184 -80225287 512336571 443233010 417315523 -184229260 145455748 -449284497 -305756035 -258842571 -835828271 109085164 -607711186 -728460635 -182906937 -539549831 -23282569 423447691 681134619 268298688 192570559 529420457 323477253 291778291 -989025428 -37558589 -864727560 -260397…
Output: 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 999693035 …

Example 2:

Input: 1507 255 -111051758 13201030 -608411288 367896481 -296400580 11478904 303856559 -925452031 -331605276 655194511 147488408 635394684 938208981 -12080060 -838853056 -759374343 715736966 -320440161 -648850758 88167542 -916725544 880561130 226372347 -158332970 685269188 -417403587 -488722502 -798637798 6377644 -928516812 384888425 -893573907 366003652 200107356 -740250198 667756698 -402128825 167110590 113333915 -85828635 521495836 -529601785 972993794 -426497499 243138497 474919059 -812502173 82988985 808890822 -625380151 -715440164 78972787 15505157 162909936 63874889 118562876 970606130 536707781 472090904 864320058 -583418998 383535939 -755176596 -42273072 -301008106 -222504715 140257714 24721732 43514207 276429905 -569664650 283194606 -880453221 -160249203 650413848 -58382089 106510036 20…
Output: 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 986562963 993553698 993553698 993553698 993553698 993553698 993553698 993553698 993553698 993553698 993553698 993553698 993553698 993553698 993553698 993553698 993553698 993553698 993553698 …

Example 3:

Input: 2773 2217 655968607 854796349 -943032521 -25215480 -959012786 724672324 -66846746 -347058714 -863269928 709749158 51118276 719633706 -675115029 191693428 -843651291 -868635456 810504474 -711900275 -924305841 -543769052 61726938 -242285588 269226520 -149104884 -514680158 489513392 -344235659 952583736 -322301610 904371484 334491799 -600679815 -968152909 365496654 -354636386 698928448 844697205 125440099 -285824735 -431197386 294838054 345551371 991149159 -857481452 -913407927 -216492898 554842948 427324991 877464858 -443480632 -252568481 -187062855 209808244 85841386 -488638429 43264093 61357724 -143291505 416210688 -901429195 -57832185 967510845 -137239168 114351315 357348593 511482746 -870250601 -741442183 -967033994 -275000541 -110897991 -485027512 -910892274 -697547278 -779126458 771208…
Output: 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 995726907 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Peculiar beacons of Tina - MEDIUM Coding Problem | CodeTikki