CT59056

The Peak per Window Beneath Tuskmore

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Surveyor the inventory keeper watches over the boar woods of Tuskmore's stores of beacons. A careful computation stands between order and chaos. 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: 1362 918 824737596 128241097 774105742 628284825 -959083355 924127837 393321474 298160069 466493083 -309648204 851831113 -464324992 715084669 -20206602 193913327 417965433 -956283103 -259668707 453259542 -371366659 -428939226 942733167 721240772 432920116 880043535 155386765 -219604032 -113365933 8891736 -400207753 -794082594 890300645 347993791 -267153277 347643300 475331794 -7300569 678722790 -149787102 -833762829 -449497569 505587622 -360939323 -966360707 -659980849 957121214 247019778 -678490227 566681010 -541916000 346273217 -465289374 -61817917 959875267 -847686156 960994617 59152390 -160031917 11554759 387977852 -899427934 -655038435 766288100 682017087 -639434471 996733338 -973633917 156610136 464980145 -681921763 818851669 -93643914 -626134199 861268146 785359462 -86684243 -445036…
Output: 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 996733338 992339005 992339005 992339005 992339005 992339005 992339005 992339005 992339005 992339005 992339005 992339005 992339005 992339005 992339005 …

Example 2:

Input: 2106 1731 708068327 620241749 986664010 399050032 -339938635 933880009 -586032343 -406551163 974530618 442230955 834075468 737582921 -268004611 -407933082 -173901815 717573840 296706325 289612336 730771522 563786656 571722621 951129631 -457249900 -689705414 -828305691 228392904 -184400312 942697215 -81732371 696024560 815488415 847311706 -538213475 813525836 -908297612 -198977636 111888872 299119394 -344751032 -211220830 281528390 867030885 -798931386 469635123 992539957 -117813072 -749300054 332969457 950069299 -670543791 376933621 -336202678 580338563 -974562104 -967847060 -855799370 -863498129 -714823998 286490516 835601162 557198478 219138807 690307843 -332648794 882663006 -727921227 -206409207 929924874 -523529337 -971765669 -113468086 -480868687 -341891260 282936227 679567805 2008529…
Output: 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 994939437 …

Example 3:

Input: 876 628 -308705054 -88388883 859415188 411916718 266424790 265011512 779857188 620598863 783935651 -289585453 -321290638 -333853587 -38773982 552940892 749639383 -778802384 86765491 524676702 -145839492 362068553 -189485642 -669969217 159980879 -282759594 -603776777 -730843297 566755302 -773215467 709894970 -184077047 495150350 685462118 -83230003 -28151139 -998653852 -646309098 583779784 -831670202 50890803 414221909 -739865228 316869893 841811344 -861059105 807054314 -654983384 -511596443 150046639 750454494 -168543946 804003683 478066983 394343014 966866077 79890288 31706673 911619280 -622172425 -413173081 -758384630 872110291 681735200 -449409810 -12044131 -874061233 -65546957 326916250 76674912 603347179 323389787 527208727 -512320065 -745596351 105599145 -370345153 859847727 38975278…
Output: 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 998929649 …

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