CT63949

Dev's Jade Ledger

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

At the thorn maze of Bramblecourt, Dev records each registers in a worn leather ledger. The guild wants answers, not guesses. 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: 782 153 886339457 -261834130 169519990 -494035880 547618681 -723189321 -199124463 -931208431 933744915 -17898634 -84015248 372499525 -96438948 -833061751 -470173223 108439276 -893088378 -58094747 21598510 500151809 561340807 -837892892 374278256 -863540650 -489241375 71341949 -917945472 110203405 -130068712 -298216087 -320525617 428283197 265006110 306639134 -769575295 -648753765 -376755308 847868906 844552797 -341768516 632491837 -842171253 -816114668 -424510557 948452100 756045354 80302767 471153805 640663335 -924590212 873752749 -368129498 639144671 378689395 -400901851 -525032921 -453972287 -72857175 -119010458 -453934683 -92036995 -527531389 -256382288 550525419 -726514546 713244955 475024808 -227539998 63971304 132334747 644470672 -737790962 939805104 -298138830 297806594 -473445160 …
Output: 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 979200681 …

Example 2:

Input: 133 52 -846231816 82395404 532121365 671975089 -456447221 -72940516 -674462327 396688895 85487383 216154406 -48785917 -817445104 -737869104 900629076 246326363 617602602 195692639 837801466 -583920449 907262122 -900721607 170520784 442858635 -803116295 280846232 442732059 552142930 39754029 51423044 -890972598 450317103 -2439526 153628101 638540623 970620959 -994451817 -361665226 -570869770 452527598 393372474 321122811 145796204 339392667 -776865271 -554107574 -706716335 982504315 23685501 -408046220 810575334 412509538 75891241 -395359556 845728655 431311463 -33214790 -377605283 -394433355 140470675 18356034 759161622 894136429 309338083 995898936 -469340196 -795081658 -257817195 -582457824 -592975026 -747270815 -525624614 -495820780 125712856 -172465824 -447714630 369414063 -570227709 -…
Output: 982504315 982504315 982504315 982504315 982504315 982504315 982504315 982504315 982504315 982504315 982504315 982504315 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 995898936 959280502 959280502 959280502 959280502 959280502 959280502 959280502 959280502 959280502 959280502 959280502 959280502 959280502 967899145 967899145 967899145 …

Example 3:

Input: 231 189 840753814 -116975038 -91463733 -386822978 260832978 35105939 253264985 70836912 925719873 -237920989 308118709 126483603 111518658 -476543321 -107754871 712821026 -87635225 377969328 846234360 111313179 843180535 204037649 44782953 994102531 -511104389 895844182 -828861687 123915063 -356133562 336261807 710614194 623327106 -467600530 -944301011 -494418160 684068963 514023064 795796110 -768573317 516474837 711343059 -364357926 -368482226 -906602399 809079916 97282702 549082324 884917731 63654206 -14034320 759930479 973939043 -293560991 145971910 387586207 -457959347 147769751 345148259 -863994489 305892370 -411875711 -440295227 -698952697 538825449 177719810 -507490585 -799629268 -675531774 185770640 -983759081 -224074457 164503470 -94349685 895794183 -167791915 512260646 813151155 …
Output: 994102531 994102531 994102531 994102531 994102531 994102531 994102531 994102531 994102531 994102531 994102531 994102531 994102531 994102531 994102531 994102531 994102531 994102531 994102531 994102531 994102531 994102531 994102531 994102531 989609687 989609687 989609687 989609687 989609687 989609687 989609687 989609687 989609687 989609687 989609687 989609687 989609687 989609687 989609687 989609687 989609687 989609687 989609687

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Dev's Jade Ledger - MEDIUM Coding Problem | CodeTikki