CT60124

The Peak per Window at Vineward

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

In the ivy courts of Vineward, Keeper the archivist keeps careful count of the registers. Track the breeding season, every figure matters. 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: 2486 319 -289443667 -25962811 -387605324 976439519 155376081 170198805 -412913500 -600396895 -181978282 827616878 -161836903 930134993 -292903927 -877394800 760446606 -125899872 -41561073 651231456 717258687 807767900 615955655 -927087646 -892530899 -585397167 397947234 -570008665 902517862 657022776 676198429 578951954 652193272 -130780770 447915678 -757622218 -116341504 -793701710 -875587260 155581128 922414659 156056752 -236814711 647979833 248073818 -475781492 -584464622 -629187719 -138445404 -847387315 371836315 585505167 -161437958 -827570348 749954670 945175884 498209923 -78681736 -916307376 -787307284 227092881 -571425767 433637932 -917106088 414881284 112324390 -533758515 -832486388 806592318 -13747899 530237748 179893387 781156850 560568809 138026200 291079257 462245465 -99579907…
Output: 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 992022061 …

Example 2:

Input: 1796 1712 -778177269 478230012 68102347 -629626359 225221765 878600666 11772759 -572826051 -577057793 -120000431 259937170 -877550906 365254828 -812521594 -56869116 -589564439 -195907357 -501695159 291473494 -403941779 -257742515 -803143438 -158950742 571168414 592158831 592175162 598049160 327909095 -281012645 140813203 -605276982 782804637 -692819029 719781945 -991895639 169159411 -956181315 688382493 -548464136 31038718 234464210 -617337952 -78077948 -911900256 926478021 602181343 698169021 462764509 -783794604 973461847 375307885 -689258788 -981024320 505966836 -752532963 -866873087 835871228 -750759648 -988393692 -669602138 -39712175 -891550931 -959398907 66011835 404112199 539474259 -974202819 1122661 920097175 774178946 430738447 -56937479 -744986055 -626329929 838359971 -154760601 …
Output: 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 998646182 …

Example 3:

Input: 1836 1752 -926275077 -820791446 -567497192 -643734976 37477696 927310399 -928427374 -810387266 332590259 -406763401 698385572 958119592 -739444036 879576392 -698060713 591208337 -970762050 473649335 971760859 592287550 -94007141 -706635878 368115132 -989092089 -500195537 -473047659 -95417755 478839846 369629401 263746623 -127485322 782241292 -902951650 -457818638 927412076 424933937 437736925 46472953 -831200774 510251546 390275141 723116464 -26994763 469681893 824574984 -437033764 273719889 857709790 955030084 -933965275 -360147079 518401957 614757479 328543801 -223358696 -238905145 395124202 53690316 302794588 -720590101 -974668895 606439165 633905488 546975457 -285376347 850338155 188257071 -702684086 880280835 -256268512 -671133542 -940299386 395079627 393915997 608700025 298372971 -21…
Output: 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 998686219 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Peak per Window at Vineward - MEDIUM Coding Problem | CodeTikki