CT62075

The Peak per Window of the Dusky registers

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

It is audit day at the steppe camp of Horselord Plains. Nils spreads the registers 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: 972 971 -974840357 313084702 984901144 881677643 633115067 -715481741 974514824 183930650 464500287 -771200844 819471373 -998683847 439862807 -979754771 -852356459 -489986151 -614467505 231516677 707188603 800530722 -387823275 -423612262 122055944 73603341 -262221219 -571928214 332129777 -161732924 244903713 -803593702 -899463566 -390547591 -208665958 -328979779 362420124 427383933 -427246987 774029288 42633800 -982153887 446563294 -720920178 -887218539 -524904301 -761114146 -341450575 598549924 -646253244 -172258969 -313818866 80659128 945729736 -524001753 518908667 -136985027 -780907995 69324428 -849727832 -453399380 -44325307 952255407 155950455 536250546 340704230 526956263 -774891502 587085254 -649212701 614110765 512193479 16862633 918917956 -517558183 -935175476 -721956345 -10183460…
Output: 996584054 996584054

Example 2:

Input: 2859 619 411081257 -80638711 -145604895 490208998 -731229185 443807236 64167790 -705572361 364594649 -770178443 -151682178 -941750933 -143738590 -51455176 -334445563 -738017350 -142057012 358184015 134849571 -450130658 -883402375 652435374 -84273442 -505455578 550033507 484122831 708724899 202892480 -33707509 275874787 226011113 -124112053 -520154800 -766185422 694919032 -717750942 -767407725 529611088 -954574439 999346754 -805775362 -89911503 810713204 -966900152 -123032156 936379513 -152989113 345489455 20641520 -473601334 -891318059 678096246 264038935 999533962 -632835508 -746366743 257555197 553871697 791025330 554621242 328818511 -819171906 -279011645 26374155 -654041894 282875167 -921685433 747973297 -927436775 -357180440 -641284318 -229064129 -284408848 305614825 -807182703 8973391…
Output: 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 999533962 996192332 996192332 996192332 996192332 996192332 996192332 996192332 996192332 996192332 996192332 996192332 996192332 996192332 996192332 996192332 996192332 996192332 996192332 996192332 996192332 996192332 996192332 996192332 996192332 996192332 996192332 …

Example 3:

Input: 2534 1718 912950135 -261032552 -750277654 873774319 266968169 306097455 542565757 -766283819 264678474 -386573317 926452871 -765837534 868331295 824849877 250786377 880622503 -749731040 320163077 45706100 -841649081 -513099591 582540214 299520870 -951524407 -259585317 352695684 -783695065 -833191713 -863194776 -300923019 -862892672 -421701882 565955048 -654360468 -782172344 -428501270 -644658079 -990549698 898544592 -712106232 -754160061 -650057638 -648544888 833478075 -753309536 126893422 -277825639 -951125922 154897315 -740563766 -812422029 435641766 -120665787 270326880 -312045389 513934988 180401398 405547383 22107984 -965775062 -1370460 667436932 -367765069 639334787 480363777 -566599100 -820275200 999275098 -780853272 547022763 -422557077 752500290 -710044638 638081587 -392600889 457…
Output: 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 999999184 …

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 of the Dusky registers - MEDIUM Coding Problem | CodeTikki