CT63998

The Peak per Window at Mirrormere

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Morning light hits the lakeside town of Mirrormere as Yara unrolls the day's manifest of ledgers. The tally will decide the next shipment. 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: 2400 2149 -577937581 86404148 533391770 -822959968 -504346637 507293549 877857020 566613695 534712984 761823151 352128444 -259570890 -537488629 105025598 313701301 689624262 -744223659 21257650 664331115 717674529 -514821892 672668592 168390516 20285499 -170461318 432758833 -215803840 -342675931 111148285 858545850 -267809810 728274865 495640184 440498251 478583047 -678545057 -982494956 -888793435 -434668463 -691589078 -875777814 -762625639 281756302 734150440 -187658171 -737095917 -818799921 429396181 794495942 544991207 544946293 -649522847 -604514108 969273935 -762513149 794935884 -769034699 -464327052 399579742 -262982206 108315386 265264657 57587659 -865564933 587438489 531410763 -51322635 997681505 -107537139 -364310313 221444044 983014928 -857146266 259079183 -568116498 697425735 -9…
Output: 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 998521901 …

Example 2:

Input: 3650 1980 -625453252 196759389 954578101 478463434 -705690206 115426136 165029123 -99764655 -63299467 732985416 140513344 642355121 -463707273 246411811 414887838 341223297 439433005 265970992 383856856 -671108287 -497105031 404665888 -970652055 -220265237 -563874520 -827677689 -599410047 -912280132 765108469 308587482 -692468627 666004041 554227512 118057504 460529598 -5239289 -891677924 647113453 -448015955 -726356898 -186901411 -632262075 427661685 590531995 -732474143 -659869475 335765522 -569506982 52813897 826981059 286943493 -66138032 83933197 -618271254 753352961 -630998010 -88475032 19968925 949448216 -101260994 493685485 553150285 -342066530 721200215 -176594763 849130136 662314416 658229186 752348323 -128171223 987869003 953941963 -59080978 453332095 -305466350 86156973 92042602…
Output: 999393810 999393810 999393810 999393810 999393810 999393810 999393810 999393810 999393810 999393810 999393810 999393810 999393810 999393810 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 999727175 …

Example 3:

Input: 408 395 -720740261 -971550842 -676021016 592109074 542931152 -212885740 833686616 614310036 877319514 289832271 -818450310 124189910 845569270 959088738 -163901047 100762624 -902288676 -596898386 -349006715 208807320 785429073 -332974696 -94309429 -663305662 141243941 -3206427 -238455643 -912847135 632380797 509044813 78542217 -359535551 -123610635 -82479120 552005182 852376407 361037632 -146494005 919098825 -479518616 -377612149 76247055 92529423 691354281 -72850084 110698098 -464831278 -853361274 451438577 129208063 -743981705 974265380 951768579 -693293877 -560260322 627272631 225078321 -28158098 -116451894 615516635 -544825862 102937595 458668070 141040104 151929626 529781224 -46296138 -317731144 359509832 -684726800 -325523304 -146869095 467296080 878859394 -748296507 -193563939 77097…
Output: 988829950 988829950 988829950 988829950 988829950 988829950 988829950 988829950 988829950 988829950 988829950 988829950 988829950 988829950

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 Mirrormere - MEDIUM Coding Problem | CodeTikki