CT59046

The Windward beacons of Hugo

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

It is audit day at the terraced vines of Grapehollow. Hugo spreads the beacons records across the table and picks up a sharp pencil. 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: 1062 572 -647527989 -785235986 -819540478 38236303 769487668 16726657 -366271672 815083300 -23612493 476193501 -449421445 -776456614 -840483837 -226569536 723176982 -163813763 -238896436 774979333 -886611260 -682302045 3319702 694830256 135324906 567829157 -193972407 50737123 419525171 -571779157 515972701 -601456410 703654295 -247739916 -771893847 668851773 978404632 -401350662 788168115 735227887 837225250 902380116 87350043 -281452736 832646445 554160170 808733673 541797462 590749313 -205315502 14765278 -575286431 -63924296 865664391 438965899 -127564425 543632852 -314804206 -867860522 -574855102 -897641819 864929209 -518278170 695292274 -784840908 79416456 -124177996 -781332132 -324347399 -632476140 -184185647 -206047142 -957194395 427133050 -112835037 664653497 -309938856 -895727031 -…
Output: 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 997588158 …

Example 2:

Input: 3924 3261 411648237 917217098 261626854 -605694219 -966039389 -505820361 321829082 332652812 633585837 -994028135 -663174259 -851162320 -253631450 -432939313 126119308 294565688 -409571585 589841224 -525606089 -690523805 -377162805 998204825 773712561 -54133735 882992610 863223726 785970092 -596927305 -537175790 735498736 -529011725 169737190 -394491655 246060123 -923784285 377514387 743562040 142138205 506927529 -99279361 -160151416 437712534 -289533181 347302433 386819538 -495078599 -205960971 -946021423 208657278 814685507 -405025819 109008931 -540034411 398284169 -868451418 -598003408 206315577 -559980201 747618025 -262959870 -33994575 -556193537 581928656 -21029074 -544279098 -941816231 -103974534 698845647 -189681046 -245077458 483929256 -43882337 -504323555 -873921416 984527095 -416…
Output: 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 999248778 …

Example 3:

Input: 2810 1982 601381186 -236443163 -596042006 246754303 -314151159 -137103537 -25410130 -701613897 -393895662 867100177 124145627 -458039501 -536261310 55227841 340437473 -920595177 -789289941 575570879 -570920641 619417219 -239120020 188844790 -617705636 -301855611 -602011372 292838952 91919258 899147757 875784245 534025376 229330097 183544809 389009588 -214059922 936188034 816377653 -690122543 113785489 38105083 193578798 -347254377 218409819 70705417 -569309842 -516082532 -680917736 -542829406 156593322 -215304659 399231624 289220802 -146919006 -575725618 207581245 -690426935 -77907609 -313462174 -962216343 83709090 -305000291 632726566 59317944 5130010 808495058 -654771023 -667609968 -536598705 717076871 -264508785 640130353 706995250 361683182 393240571 841292248 -998167088 757915195 -402…
Output: 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 998389378 …

Constraints:

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

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