CT65282

The Peak per Window at Bloomglass

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Caravans arrive at the orchid house of Bloomglass with crates of ledgers, and Mina the measurer must account for every last one. 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: 1619 450 -965986778 541546818 687718478 198992354 90971295 330250918 -475349861 888704258 536958061 -716814612 331056699 -236496439 953853705 -529527207 -68322668 -654276912 -72955007 -283042503 -50545828 -241408710 716543042 -177182278 -572620711 -11026756 272225769 -105026142 901042074 128763006 -516594887 449072936 -543257794 -989472283 735218457 128272334 -642577501 444874186 -113360648 -634882510 -301628556 670801775 715404064 -51421622 812421940 328964228 -340053584 218353669 -329585663 -541403303 -63024451 816891002 -870214012 452435276 -557064089 -131272156 608216527 999074416 418376111 166596221 -955986686 -780037619 57184836 885171047 -423717076 -644267572 -727654085 903326961 139288593 155280738 -519683510 -614035372 446372663 564173808 696484913 843197995 -737474061 272638289 -…
Output: 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 999074416 997168443 997168443 997168443 997168443 997168443 997168443 997168443 997168443 997168443 997168443 997168443 997168443 997168443 997168443 997168443 997168443 997168443 997168443 997168443 997168443 997168443 997168443 997168443 997168443 …

Example 2:

Input: 708 184 341998352 -145598920 -502864844 30725976 928184574 -376959664 -57689091 -158636937 640162203 391061424 -400723941 -805832520 -482769009 460618718 -901856609 -413189701 249562958 368855305 -720070844 896643683 -457248315 -728056869 -312661323 -478101645 -914206001 668818224 -37429679 -985587519 504565849 317173519 482045183 -890434116 993413917 572111039 693683540 -203744364 695774210 737607190 878644136 -800646699 -139720840 -708247153 409369130 -190107109 353968720 773378658 -245440965 747831654 849100105 383796630 446951425 204676051 621767231 646068704 866512983 -779157552 -269011693 -256996499 95506264 936783132 441635569 -63227586 466755335 496770136 83614256 -248895457 -738668703 -587434151 485104108 541587912 -207712957 261324293 -85621880 531585058 270537697 695265777 53058…
Output: 993413917 993413917 993413917 993413917 993413917 993413917 993413917 993413917 993413917 993413917 993413917 993413917 993413917 993413917 993413917 993413917 993413917 993413917 993413917 993413917 993413917 993413917 993413917 993413917 993413917 993413917 993413917 993413917 993413917 993413917 993413917 993413917 993413917 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 980343599 993674729 993674729 993674729 …

Example 3:

Input: 2445 1972 -919346210 -602807167 -444355508 886808563 795755856 -885429301 432037166 -469389242 -726764812 270512457 -728224282 527899319 803557312 -776553736 -357313178 -128215443 -598276553 -942889985 822213575 762475142 -747780421 239945974 17276517 -462562749 740195886 472851723 530965243 -551172875 725309047 907429106 753703196 -826867079 -178591461 712285893 -66846095 107711938 662888654 842569422 -608589352 258073628 -639576946 -336461674 -68036296 513068331 -722174077 -192431398 -47414401 -734150301 -831103229 -298427009 -754573725 720016318 -297001080 -482332998 -861932618 -891509925 277691403 985359313 -145008758 -498506952 -29206767 -613712020 -726997815 -132021336 -235863300 -901086228 306195042 -138009524 506627977 -586244904 498783087 606997952 -211927069 -18764669 -280010951 …
Output: 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 997195859 …

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