CT58995

The Amber Peak per Window

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Deep in the port of Emberfall, Freya studies rows of registers entries. One clean number will settle the guild's oldest argument. 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: 1186 1177 283152945 521692368 -37099562 -868469326 -788318870 -912868972 752269772 385075656 -855030105 -699882849 339927984 -140133939 -331055736 -816956774 759124981 -312259591 304605078 -705059286 -993033632 934708060 206229022 -65664321 225463452 347448126 -771543070 27529877 -600896259 477083402 331196649 -280956241 -217056570 -412473749 -458660423 -575411670 -242364100 -970171912 -777334583 -885351460 -458370134 -418570524 -3980976 700541951 6283164 167258177 804111943 204195633 -481279326 -752222878 34436089 -512879300 213318505 363015837 -538302081 724848521 -374624944 -298903505 266679109 604494820 -912619859 491167892 -297214411 -49568694 665049892 472881234 949753101 -742874540 642908857 -667936977 936452373 -878476924 -599508126 330311550 232776106 994353375 -404023038 -4930559…
Output: 999718773 999718773 999718773 999718773 999718773 999718773 999718773 999718773 999718773 999718773

Example 2:

Input: 179 4 -358712134 -591058944 -391329233 -65064199 -270242181 -604862731 251740276 -741001019 -224709229 -998649061 -919315816 -579443029 -509847525 -155027082 850268277 661153456 -429384624 -410477389 -522172050 -256631563 -427254648 258601101 484708359 -168042706 -747171931 -191794961 492863296 759282426 913400260 12413119 52252154 -158741542 212700508 -293824743 -556831662 -889573296 75772735 -998165626 645395521 -577733693 61528140 -794866138 114285682 -41006385 535409230 -827272019 873421317 883578741 -192018160 776314955 999459330 687426524 974959459 641527688 595238180 552754889 -941682556 -73848662 -737302543 -767064508 -575734237 -997751229 938633844 -928729441 -792270910 -614591561 618265897 -423430638 772897670 495481766 893190224 -58965504 -284315261 121406792 -517095808 33272386…
Output: -65064199 -65064199 -65064199 251740276 251740276 251740276 251740276 -224709229 -224709229 -509847525 -155027082 850268277 850268277 850268277 850268277 661153456 -256631563 -256631563 258601101 484708359 484708359 484708359 484708359 492863296 759282426 913400260 913400260 913400260 913400260 212700508 212700508 212700508 212700508 75772735 75772735 645395521 645395521 645395521 645395521 114285682 114285682 535409230 535409230 873421317 883578741 883578741 883578741 999459330 999459330 999459330 999459330 974959459 974959459 641527688 595238180 552754889 -73848662 -73848662 -575734237 938633844 938633844 938633844 938633844 618265897 618265897 772897670 772897670 893190224 893190224 893190224 893190224 121406792 121406792 314706022 314706022 314706022 314706022 141043177 141043177 14104…

Example 3:

Input: 2151 1921 -2079234 -908825322 357829609 899370931 248847674 -385406226 612507979 -971181217 -992713981 -951974629 -309952453 533448514 565464022 -239386904 -752072356 78077191 73121341 -41678208 349080314 69650681 -237540479 -851549431 794925822 963528026 859188804 651588072 -668592213 56541989 689868556 -297269672 307299056 -339475340 150551020 -875649399 726106449 -67791562 227282050 408131848 -40855504 -142664127 654057861 606092357 -629619972 700609927 948580838 -947823555 -664289183 -606627870 -443368715 -9905372 -495544434 548767617 77853109 859769930 696328743 243054226 302153812 -42629541 -157483967 69398912 -957184310 -67921371 -698405407 418508758 114608802 -251331835 317443151 -447902847 674188760 -61047752 -254189315 -772703989 -272257345 307463690 -928451699 -460022895 4059839…
Output: 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 999614598 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.