CT63706

Harper and the Golden signals

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Legend says the vault under the marble forum of Argentium opens only for a perfect tally of signals. Harper means to find out. 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: 1483 1472 759346851 -323499928 479609723 339107185 261591756 173721340 456541239 775652143 -406669742 740379556 -229845094 -996474684 -813169140 -26112109 -769758549 -987028204 998579786 -894296914 -98173615 461286038 728021191 -242134907 877139299 -82933744 -575053051 -654741095 -898490502 -728823154 287725979 423041825 -326500162 -512300280 -298861627 814438012 -609130070 -571327390 -897564114 -64477736 -108737201 102406760 69850611 999497705 516534507 -628542625 -179139728 447100139 -743689785 -86658354 -359382079 -416538198 -884865699 -662808889 -611576748 330809593 467460541 800173993 -646105670 621706274 979597373 488883654 451820802 414055177 304808639 498687246 -585195869 718802963 844133881 -381890735 -637962912 -923816275 846244091 -813015372 -74675806 -127010301 354918078 -75692…
Output: 999497705 999497705 999497705 999497705 999497705 999497705 999497705 999497705 999497705 999497705 999497705 999497705

Example 2:

Input: 428 77 250761073 56050838 22267090 853584328 -328891688 -247824837 -85550630 345999653 -855394618 677729220 649778829 -771469493 -15395265 -698985888 23874729 548383707 723402364 -312742755 -300209263 57055007 66356150 501469669 -76011747 250223104 966891379 -687155792 353843927 414385984 -502203163 785537457 885420726 -972480039 350539688 -877297851 533139437 -140653528 -770054370 -891735530 -672794420 232165844 636685851 144735856 -174828196 -93635855 -222362399 113954772 517183881 -732373550 726049856 697204706 469090249 -319070093 402884600 985124752 229420385 436136670 -312688677 892720476 358263029 463495532 669309082 847481540 801626581 -173719318 109284149 638144518 296441785 226693534 -354747815 310096750 -272265249 813882941 -36346735 513001200 -978337472 975554256 -356963125 236…
Output: 985124752 985124752 985124752 985124752 985124752 985124752 985124752 985124752 985124752 985124752 985124752 985124752 985124752 985124752 985124752 985124752 985124752 985124752 985124752 985124752 985124752 985124752 985124752 985124752 985124752 985124752 985124752 985124752 985124752 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 993368591 …

Example 3:

Input: 295 202 -6219057 540803124 19554486 -871669118 944764598 -697678910 -422435131 -683703733 -802316780 -891111354 -552115955 734214365 311835676 577391362 963953236 -654751296 661017741 515111696 -914623086 887387720 671835119 -503958377 912821728 -686293201 998881117 321885201 -145178589 -131120253 -153125190 805678711 671200880 -3217939 695694873 561628927 829369348 626101563 274425435 34717521 -389296245 -824678790 -733903869 -255083766 552238874 104747222 838507819 -274194646 -569092159 -961216774 594896663 -351339868 -601364892 -494821554 -101282202 684814724 129177843 710723837 340835228 409107942 -981268082 861823138 -457368700 -768318629 271970692 539523682 -524446714 -618106772 330964222 178062580 484128004 -1053040 263695287 10217861 -616989165 898854190 291466635 343382375 -524581…
Output: 998881117 998881117 998881117 998881117 998881117 998881117 998881117 998881117 998881117 998881117 998881117 998881117 998881117 998881117 998881117 998881117 998881117 998881117 998881117 998881117 998881117 998881117 998881117 998881117 998881117 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 986644305 …

Constraints:

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

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