CT46259

The Peak per Window Beneath Hammerfall

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The council of the anvil district of Hammerfall pays by the answer, and Owen intends to earn it. First: the full register of ledgers. 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: 1064 693 -927986943 -373038830 -125618470 694448239 -801317247 -853442918 1701735 644803367 -197422418 89496185 305374155 660408181 754960726 -328110634 131145767 461478882 -86854076 -714166822 136828409 -981707035 -634338099 899032699 197325544 50121683 -684478243 377776499 704197303 -972447058 288318172 758206276 -934711347 564740563 -80185536 -998845188 344238038 -814849915 -414809548 -725216402 888134144 -192122271 -700591958 789082105 263074051 -53117267 -894677132 725285427 276501585 206164683 424829268 627251927 384332408 181116143 -225651182 198888240 709386943 -380522940 -816319201 -985681024 586991318 -711258863 -771712968 -73358126 20733356 236894250 -186162861 -361875983 225754733 721105298 351147201 -459356612 -116736945 891820803 17864126 597372519 -754800824 461146090 271889…
Output: 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999478000 999551011 999551011 999551011 999551011 999551011 999551011 999551011 999551011 999551011 999551011 999551011 999551011 999551011 999551011 …

Example 2:

Input: 34 11 725522552 -561609739 249481754 423781055 742102531 -223693497 729714213 800905271 -389632781 -66793157 -180924335 -387930728 -101101341 118635395 860830611 431664773 -981457173 -666218402 994328840 326397453 -413986610 -522710757 -572330560 985496675 339063030 251204958 -264375812 564127669 245104621 -242224898 -28415274 94438008 -204108881 969110593
Output: 800905271 800905271 800905271 800905271 860830611 860830611 860830611 860830611 994328840 994328840 994328840 994328840 994328840 994328840 994328840 994328840 994328840 994328840 994328840 985496675 985496675 985496675 985496675 985496675

Example 3:

Input: 1964 1795 -592089008 451718419 -971727870 261368499 -59436742 -853829245 21531987 337778975 -307942737 751245934 -368333270 244687268 -455618411 708943926 443088121 252716813 -654492214 -219470549 -66680252 61707766 -464169941 -239082731 -532682019 585382833 411181398 889635525 -665272490 280989513 -102915802 -285787905 -825957695 449976681 -453038300 66739751 9243323 -948975640 -429541002 965462431 -401063981 -624798122 127308177 97916426 453856189 80741482 274140319 -358070869 -48311574 441533599 357958749 -176287349 -738183421 -448612104 649343620 -797993891 307467486 -254788610 319573657 469337221 -572316054 457014156 264764817 -190820911 -374475953 422172449 16307593 -396204133 359575004 -542991556 177878848 -866569232 834149403 -191120475 338035979 886767606 -944063118 763211982 -744…
Output: 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 999973519 …

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