CT60983

The Peak per Window of Lantern Tor

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Every season at the beacon hill of Lantern Tor, someone must compute the guild dues owed. This year the task falls to Isha, armed only with the beacons register. 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: 1313 635 802210200 642831381 -295017245 -852994698 50124195 422474040 217446393 -333075819 752876719 133359099 -34574032 164173733 -835491361 -630760810 533385665 639859901 899439867 136357897 -867167917 916325102 366556132 107094231 25330336 -719423874 -485606030 -54302981 -88507649 867483840 -556418064 989226445 -624781053 72776425 -515423328 845969608 662603613 478483138 -427194836 522442946 -186582447 -555263674 957851357 414400724 -481066904 888966800 -324682136 -521185115 -994948806 892932891 954814999 -321357910 -802035450 -308297398 971318386 -794184423 -593797347 -680297134 273573828 484791165 -980484025 -475056331 -43976105 165821442 268256966 333983295 6297274 -215191783 795760809 92516046 770140202 766635666 796019575 -319181786 -170204292 -860448538 -273295032 -121865101 81204…
Output: 989226445 989226445 989226445 989226445 989226445 989226445 989226445 989226445 989226445 989226445 989226445 989226445 989226445 989226445 989226445 989226445 989226445 989226445 989226445 989226445 989226445 989226445 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 996630366 …

Example 2:

Input: 2092 694 710096908 573825985 805357003 365176880 -29375254 331676400 -287276444 918007728 986163335 203058149 960205058 -109958037 -265075738 889936909 932361245 220593309 923465455 -679735554 328304296 -816443718 -955970737 9833803 -436912790 261263298 -254915408 -309696396 75391301 -256994538 412821569 817754055 -822327257 484413763 709773204 -880457525 -545651944 -99719931 -329951831 214030536 820170742 534626972 -691470005 -26316317 413834365 -239939537 -560828316 -33677315 539796999 646207406 686494694 966247427 -980144038 77478467 -241053442 -497524246 734200554 -247482859 258693307 -969587814 -544964100 693295294 -665959103 -336002441 -979384050 -445398102 -224424262 -278331369 789889689 -691485708 -245111562 -729185632 490022136 -213655274 968855784 398858472 -728956890 794286643 -…
Output: 997759828 997759828 997759828 997759828 997759828 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 998499100 …

Example 3:

Input: 3902 1608 996636071 -832673802 120113481 37429094 -690949247 113728059 331144167 -657765468 366080472 813680613 236965289 95949086 993233140 309495687 -93677321 38959166 202800079 -761949829 936977946 -201249704 995720926 85737439 -14326153 256237357 185341946 -281010660 140576353 -837260262 658455119 77602405 113297745 -251457064 546216259 -908274454 -783523879 -788167623 538446926 985735255 -644173125 -74543714 -565058167 286481951 688993570 410499078 -2103341 12029400 704080660 264940095 -342004193 -272321602 -34235056 -630887519 -617992110 -652306839 287165660 485171378 -865714935 -965466032 967462113 476100642 -287769935 -412756869 -928665680 -973966281 -16495680 -843095678 -902694683 829309607 69229170 -99967576 -710535557 982048954 376766867 110630581 552710549 -937194801 704721335 …
Output: 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 999790806 …

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