CT57449

Jarl's Peak per Window Ledger

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Caravans arrive at the rook towers of Chessfield with crates of marks, and Jarl the dispatch writer must account for every last one. 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: 3021 1168 -411774690 -619273925 -127988846 -964202184 22363058 588445343 412708951 -1194623 -497006487 -667592680 -649525312 -808237999 -247927884 792147507 410113850 -554378498 439519125 -183886442 624997749 -655366059 -510172106 -791423603 545394495 689290834 969654855 587640188 -606665967 -437353084 390443012 -142354324 976625932 -594214766 -504573117 20636521 806732943 299663157 212726148 940354068 -678206064 552814552 565514829 -771941600 868721936 518469709 -1883678 144512696 -304566591 680744490 434921868 702139975 493777716 -118721191 -722272543 -556792774 178654826 892238339 -461242760 -587841897 966699713 -416719695 -67398449 -480794979 182197454 208196921 760102999 -984802644 -979277072 -409030741 187095543 985928554 -935106378 -894133130 937817436 -867612897 58796615 925327262 …
Output: 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 994033859 …

Example 2:

Input: 403 297 407953371 -943691460 -610879003 561692175 106682929 -469415844 -363850958 -553140346 343575106 -708261065 -298865739 467534235 638074535 736308835 -28867471 -579817654 -203187256 585911307 976208987 450132421 869887165 476211252 874346141 -212905116 316631798 -270657158 -456769350 362409414 -671026159 202856181 987005753 -869755335 -426495591 546804766 962763894 633178110 731590438 583046705 355692753 553099204 -152340396 -713357176 985612354 -773183428 758394585 500579678 -334689197 -861261213 -350070158 -666849666 993802323 -327712185 -176209587 -643118703 833284538 825390687 888221908 -591795501 -320511772 -201931253 518057906 396045359 652674408 -812779566 -851714137 340616155 294627085 891076413 269526966 -438241179 245988141 -120447203 547519003 -954393417 57269190 -492358125…
Output: 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 993802323 978577436 978577436 978577436 978577436 978577436 978577436 978577436 978577436 978577436 978577436 978577436 978577436 978577436 978577436 978577436 978577436 978577436 978577436 978577436 978577436 978577436 978577436 978577436 978577436 978577436 978577436 978577436 978577436 978577436 …

Example 3:

Input: 2828 365 -136866273 -716173941 -589490329 -384116778 788092316 -345676580 -395008161 792917622 569050252 417679358 1833613 -523776828 727879446 -554236336 -296392886 917725943 405425026 340793874 -501866935 269222679 -26607976 509331695 -112812215 831135538 -368774241 138709447 135191221 234473113 -543928344 999081570 -642417266 425942018 -339912494 -843399118 828796439 -185338844 -977169834 296020397 -669223951 370930714 -239648468 931587433 -873629205 143953563 -688832002 -346103630 590573031 -9628085 -992503525 -504176204 -390044105 188505755 898323361 -786933113 -865117266 985490923 -549546188 -543637459 -8185325 -693063779 598115014 135834069 -88288984 -228999464 -366597970 -35293263 196959257 -693925712 426894834 608061813 621058660 397826671 21015740 -682031272 107517886 -425956332 …
Output: 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 999358672 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Jarl's Peak per Window Ledger - MEDIUM Coding Problem | CodeTikki