CT61510

Chavi Counts the signals

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Chavi inherited the exchange at the tundra station of Whitesnow along with its curious bookkeeping system for signals. Time to make sense of it. 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: 2342 1122 -266206040 -14371612 -868214936 214443319 690095424 -941685861 407141058 -85873805 330240354 -960923618 -785225649 -357953612 -952742191 -962457810 -422230573 469729160 -499531467 647188150 -446340278 166484582 -212511552 536274004 -141262843 -543212129 806004164 924589737 747512685 -808300838 -573415476 201430045 391396086 20224 636316276 -441663055 -691136611 406270695 -790169140 -894582191 -151678459 -616111037 -470790514 938636557 -238164078 -59363850 336175009 888964082 332519071 -972892396 -134473118 -110283635 3877123 -327462183 117656489 478340760 -525367098 -542753639 -951571351 -450316519 -614619262 932463149 975574000 215391905 572581986 -259697713 -288685851 307187045 -116788119 -652714704 997802970 237062197 -499427153 120797222 -708279690 306041121 -925889376 -73570…
Output: 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997802970 997086312 997086312 997086312 997086312 997086312 997086312 997086312 997086312 997086312 997086312 997086312 …

Example 2:

Input: 1525 809 413635150 278318301 76626930 -815684035 311875010 960691448 -518255241 -756276454 190027148 -361821563 270744677 -351905725 -32208411 -345013091 445321990 315284020 -236380394 258281766 985495234 -869454410 284216247 -860155285 -774233348 -448840662 449488476 330359564 922278207 165949862 -184272844 406199097 -383797800 -765780455 750511603 364671073 -237704826 -610746739 -681323376 522045320 467138349 -110452856 525542845 -430144994 -285010864 78122564 326816525 568849854 -463607896 262040527 -139833013 -887213047 908729077 -264120994 272742243 414927189 58125795 80488204 -777728143 -75671540 -151590615 659752518 -825620939 -864944636 -192386269 355373908 674616136 247457089 -681174056 -708641979 -645972109 206556449 327880530 -33854515 -457109216 759267130 -319837893 -261782658 …
Output: 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 998520642 …

Example 3:

Input: 3559 1076 -507843912 380230454 -589510323 513560740 778092332 527960191 866005298 683097533 -135587121 495185470 301911692 -768682789 554272687 -909249759 643254413 671953029 129232960 -3557029 -120363620 -852774113 943280612 -114420605 356236117 407326598 -131816070 323254632 485713999 772410488 533838062 742161189 -174849978 -377344901 849318896 -971073107 933834683 -123606972 886595508 -632144466 -841755523 481820754 -928958709 987470379 -247471732 -780513223 -993382838 -879468671 -405320478 -466999717 -970918630 -872820271 398084159 841082779 -18553679 -758958244 -428261513 822442245 -11359841 80056520 -300195366 165651449 -281158622 936974441 -529187263 -277197076 -18493281 -142268616 629497203 451339769 -751348806 -753555183 72483020 -766301265 -415780768 -685502147 -584232398 446884…
Output: 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 998202577 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.