CT61683

Lila and the Peak per Window

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

The council of the salt flats of Palemere pays by the answer, and Lila intends to earn it. First: the full register of registers. 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: 3500 2112 613509896 592425080 -225111351 257552787 932662579 -523118038 776453156 -290634333 31380342 -919508916 -107564205 765659364 -731317558 710814518 370522627 -616420534 -420029791 -274877992 -820554763 -602370231 -185914796 563765393 -481656552 -897432698 810522773 312849572 919943074 417081109 407102939 -103107325 854682424 420664366 71332036 -93891002 896363659 -692421579 78991211 381144066 -545231793 123177939 593723731 -709616100 -470616753 670931147 -727352637 876088600 407011199 423363020 -924261127 -984562264 32096709 -272889635 -477083943 -66696564 -709120852 -277659290 -739159593 -928722368 322391279 433172242 -567583300 280135206 -904454100 676726980 -722935614 -343548498 587537036 664208467 -303125086 652842180 531331280 949710102 -123089665 -972251443 -810020225 -5013963…
Output: 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 999301431 …

Example 2:

Input: 289 76 -4828809 445307489 -178063611 -604002936 -837475665 855717147 139809067 65817306 785744390 768505147 214645050 -434835460 -340408762 844960692 671124571 301678902 109316222 216704371 450446840 -107651777 -714308898 -844018422 688705870 62058966 302015314 -348421275 889318576 730054394 661716082 -697600797 288378543 -23504942 -716220163 -124913354 934024995 371876316 -854045939 -16819151 661645627 367216765 627327373 -492596358 60319341 -819414889 170761922 262302692 461243389 -659624240 336462381 706584849 539889943 -195721803 -524236958 898949822 -741046417 715756489 -669702266 -459747596 266198428 419956897 -86874821 820399097 -882166967 -918363166 -268061150 -909491143 840359369 848661162 -574335118 145687931 -552343402 -895449964 -198026646 -181166495 -620895641 -657792091 -6746…
Output: 934024995 934024995 934024995 934024995 934024995 934024995 934024995 934024995 934024995 934024995 934024995 934024995 934024995 934024995 934024995 934024995 934024995 934024995 934024995 934024995 934024995 934024995 934024995 934024995 934024995 934024995 934024995 934024995 934024995 934024995 934024995 934024995 934024995 934024995 934024995 912758108 912758108 912758108 912758108 912758108 912758108 912758108 912758108 912758108 912758108 912758108 912758108 912758108 912758108 912758108 912758108 912758108 912758108 912758108 912758108 912758108 912758108 912758108 912758108 912758108 912758108 950073347 950073347 950073347 950073347 950073347 950073347 950073347 950073347 950073347 950073347 950073347 950073347 950073347 950073347 950073347 950073347 950073347 950073347 950073347 …

Example 3:

Input: 1243 381 205550429 754454836 -200013121 -807762086 -467284403 -910918802 -675042057 -410442801 -219292452 -96193977 549364882 -27611379 72230158 310903285 -278447876 -255330447 470958801 -311635459 -306932873 794413650 -648719827 -898169882 210114478 51875723 977466318 619099890 546275324 -315274960 631293098 -12119253 927419239 -441072190 -362153533 78175958 917564874 830273119 -685352928 562979628 -102622698 -593512610 253283788 -314692953 742436869 927397914 93877281 999567605 -545736132 834595777 -528186201 -215145355 731670213 67642831 164902844 938719727 415316373 963112009 -741090013 -626304015 319829644 976362910 -525425615 643103645 -471189930 -706869120 700212629 37854022 563441795 -593380826 -502216254 549168553 932282026 675390893 -957094621 410797319 997694662 -640903382 -7255…
Output: 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 999567605 997694662 997694662 997694662 997694662 997694662 997694662 997694662 997694662 997694662 997694662 997694662 997694662 997694662 997694662 997694662 997694662 997694662 997694662 997694662 997694662 997694662 997694662 997694662 997694662 997694662 997694662 997694662 997694662 997694662 995970156 995970156 995970156 995970156 995970156 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Lila and the Peak per Window - MEDIUM Coding Problem | CodeTikki