CT39708

The signals at Echo Dunes

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Eklavya runs the greenhouse at the singing sands of Echo Dunes. Today the books show a list of signals, and the numbers must be worked out before sundown. 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: 1452 107 -64042048 713728736 81068011 425730283 -364601434 -512411987 -929371611 -663003304 824173816 -613858973 308030253 -482234188 -18493198 702889575 796845227 -529784488 -774937500 -456702999 710393466 641552595 -766591247 103303247 -251214702 -280669419 187887843 -667567998 493373803 -105085216 98994049 946373833 -941715569 -647308362 695982389 -949096846 -270421288 -847785639 910325233 -52591402 -310966512 -934873167 146125225 636671936 -245062216 807528603 -744259803 -240426206 98944351 -121779121 608812512 -212679387 724691379 568009611 -725329104 -474191694 750786755 220148910 -985755862 151959556 -857761239 436944918 -40923188 661141066 -893120511 -833764400 -148832338 392577169 -282524832 -86396035 138826510 986951281 -270246061 -445663152 508664012 -941039324 714690089 1475479…
Output: 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 986951281 975621415 975621415 975621415 975621415 975621415 975621415 975621415 975621415 975621415 975621415 …

Example 2:

Input: 317 17 -572035150 -300503422 -12278579 14602 -345601527 692974859 -40046606 244006151 -692420165 -196043574 818083995 -88895066 -307635972 -520421257 527793937 604814049 965434580 879951224 -314129774 -792600389 -782124786 926734017 -22020733 594091850 977731857 -653288581 901254530 -927074100 -84926992 -526195447 -24828401 -518587714 -387786699 879435612 -360932496 189291454 -933816375 -600352137 934391068 -544456478 -507567710 1558061 -619610580 508696090 962660253 -183488860 956775341 264963041 602646762 -253844854 -663191258 940734934 -871206829 426555621 -861433571 -111577237 479063195 -899361590 -777754984 162039481 -362677347 -877671273 698077064 112714289 711407178 -416040173 -686922104 408755223 -262435424 158694403 -614927470 -798993811 284519569 -587245975 622617247 -68769105 -7…
Output: 965434580 965434580 965434580 965434580 965434580 965434580 965434580 965434580 977731857 977731857 977731857 977731857 977731857 977731857 977731857 977731857 977731857 977731857 977731857 977731857 977731857 977731857 977731857 977731857 977731857 934391068 934391068 934391068 962660253 962660253 962660253 962660253 962660253 962660253 962660253 962660253 962660253 962660253 962660253 962660253 962660253 962660253 962660253 962660253 962660253 956775341 956775341 940734934 940734934 940734934 940734934 940734934 711407178 711407178 711407178 711407178 711407178 711407178 711407178 711407178 711407178 957455071 957455071 957455071 957455071 957455071 957455071 957455071 957455071 957455071 957455071 957455071 957455071 957455071 957455071 957455071 957455071 957455071 948641174 948641174 …

Example 3:

Input: 82 43 300322219 974906885 -141353933 -205621612 216784794 -140338912 634035419 23050982 706659805 -416546457 -538508844 696494679 -856488214 491116847 -50999144 -650811905 -787365944 -670709386 187505390 871439021 -170357495 439249744 488989840 504962815 -106236295 648152039 61127204 -408248763 446174782 213830549 -762546389 936135973 -555707085 62120071 -744962996 825119054 110346513 378557836 532882764 402544735 -571881387 -586492086 -331284219 649807855 919448565 265576689 -646248044 871851621 382732276 -374333652 -390167130 -107092088 -260740723 -830343826 662706375 -977368462 -88253542 -532057763 -480955368 562527230 603589790 498649945 -664039802 268638200 -818846565 783895497 -449804664 78124011 -892256213 -489774086 -478284827 -338694850 -417095888 362998336 84616981 898513318 6185…
Output: 974906885 974906885 936135973 936135973 936135973 936135973 936135973 936135973 936135973 936135973 936135973 936135973 936135973 936135973 936135973 936135973 936135973 936135973 936135973 936135973 936135973 936135973 936135973 936135973 936135973 936135973 936135973 936135973 936135973 936135973 936135973 936135973 919448565 919448565 919448565 919448565 919448565 919448565 919448565 919448565

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The signals at Echo Dunes - MEDIUM Coding Problem | CodeTikki