CT61452

The registers at Pearldeep

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

The harbor bell rings at the coral atoll of Pearldeep; Rosa weighs the day's registers manifests and starts the calculations. 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: 3368 1222 990087862 -192751213 490462930 184525060 443342827 411409281 -89563452 -251033775 -8574755 791090124 -460747065 976070294 -268995769 -618932892 903364595 -738434695 -489877299 506341161 -495686402 721548893 -947188578 846857731 801180571 806943831 -129723061 -96963471 -31374735 664958709 -774260030 -565183805 83585601 831829439 745576981 -138021151 -284562794 -941009346 -7275476 -600044390 -986893332 124969433 556377130 907055358 -661636172 775974824 692233458 -312511629 639892529 228269893 805396453 528759562 -455215321 547533297 248111828 -636098388 717126137 -640175604 -828163299 -305084757 936548520 -221744809 -421022334 464531471 391926897 -873414389 32728348 554212332 417752672 -760183206 991347065 88487637 -453545035 759118957 276646933 86098903 135181252 707989185 -587637…
Output: 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 999314236 …

Example 2:

Input: 877 706 385468491 318404352 -639229327 742561128 86356163 -570683780 567453572 860446346 64536017 521378332 101941690 34475901 335307383 -724600563 -786733278 -641477534 731017824 -834871594 123963093 543536607 38255441 -448819267 100582319 750938145 -245178516 -395168289 -416488219 425182039 182095567 522113486 885021128 413439780 423551028 -971752528 163654498 586672579 560760586 -127909441 -843592784 299948983 -509887357 -685330950 950716035 -814926021 -119273342 -941966821 600225401 553629471 520240814 -412383370 11751456 -990635297 -821650944 87580783 -692539951 -511835642 571688964 580372545 -735279234 188369979 -205169962 -207095641 53035813 58843231 351954498 -359816760 240643475 -808834228 -454187937 -289773629 10422308 -704713934 -908064288 496336910 -392581755 -701935037 4498982…
Output: 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 999979451 …

Example 3:

Input: 1528 105 883248573 -235444663 -544328020 -210939884 328347312 -161925459 670573995 605807660 -756203491 -49599848 167675088 -707363141 852550826 -222689329 -783297403 -802105612 -573501936 351129088 561240294 -882432887 941432804 -611609966 617918832 770878861 -517259040 -314239661 645137587 -697387640 -313555758 -831170748 232386494 -267239250 431999000 -543628451 -845574225 -198381785 -452716545 -927141369 945381425 880750893 -819072867 -567395555 -792256398 -734652054 841532719 -266805337 -251756019 -914354367 -866264172 549276069 -625349235 683559747 -694894772 -223082241 140593718 699341885 -198715915 -148040266 -555283896 -291638119 726617017 829049431 -945569004 -32171245 751589846 -352769325 910788561 234350270 21764958 -492468902 79382949 -398017111 -267020021 -839477689 817071568…
Output: 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 968592978 991193352 991193352 991193352 991193352 991193352 991193352 991193352 991193352 991193352 991193352 991193352 991193352 991193352 991193352 991193352 991193352 991193352 991193352 991193352 991193352 991193352 991193352 991193352 991193352 991193352 991193352 991193352 991193352 991193352 991193352 991193352 991193352 991193352 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The registers at Pearldeep - MEDIUM Coding Problem | CodeTikki