CT55388

Bright signals Peak per Window

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

It is audit day at the marble forum of Argentium. Orin spreads the signals records across the table and picks up a sharp pencil. 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: 1925 1356 301450039 431908302 839161482 -538064693 629270080 -452778452 898200921 -646893223 -676514243 -811745233 502103221 784686504 -861484077 480387509 869921085 -538953824 -615283389 824662017 -520637154 239789468 -20996308 31172578 -227550559 60698596 561787554 -616257025 -561602602 -745187703 159406041 699107712 461576409 902470801 -919491117 550892003 378499353 929667040 -659475324 -759876931 -780412839 159992432 -779676433 107535538 -223677811 -410989467 -310699286 -364810571 488536638 -986323899 248759493 -322320109 -455776197 -630009163 -42585312 -662223054 -888140951 -877059597 723763903 -536280779 197844347 -162707268 -481275539 -93868500 23127422 933166812 666787807 484005767 -583803444 261564398 -335118776 -507018323 -835151130 -530270268 812018864 774591447 -874260878 71847…
Output: 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 999274698 …

Example 2:

Input: 2379 1389 465152335 805453046 874011554 -228844624 -162420669 -315525435 -587304851 428907616 -741984465 -764193037 -189451506 -650275045 -830152285 669841503 -116452259 179645202 -772230201 125153700 506341790 303826909 446409048 844605202 29655378 160350585 -302494566 693987330 128561687 510380294 942758818 755303966 -815575912 -188593618 217062690 765840858 831439711 307155792 351601905 470016113 -2270849 -742656543 478164043 450741638 -392916804 -379306752 -395219069 792635218 141314246 965620698 -502087147 451546316 -181205643 95306336 -646222321 193849765 760307942 -804441745 -404576690 -13699339 921638517 -485365211 32440672 923841688 -472931046 -587957389 -964281237 444553787 -99948135 -241275466 575642999 -457917783 234032853 195038197 -644159349 -160601095 194586327 588470528 755…
Output: 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 994847170 996625634 996625634 996625634 996625634 996625634 996625634 996625634 996625634 996625634 996625634 …

Example 3:

Input: 3422 2311 -264618506 -496827796 -120613684 840211214 -694318693 -483499838 351354869 -214719647 -856844181 -827751650 -392480452 -590999298 479896206 -528875117 461350423 534366867 320471145 607063118 124000218 -846362057 39624797 133449032 141969595 -649536107 -725319424 -95364125 -559110764 273100945 902253354 -886515907 535227011 222800844 -914257307 -87182356 817228844 -149912628 706322401 -324353870 -846237831 -388630338 -350027121 130559574 223378159 -246723455 -115087657 -487180909 561251940 -746706814 357641582 -829974753 -334736275 968688270 -197862621 -810032466 891151161 -517628662 -134220525 -302559626 -737063543 -454761715 -458421049 963924578 809781178 -93694788 -80072607 -646074182 873551364 109678402 251032329 -752795555 -903065379 -442966979 -383233343 -454540465 575668696…
Output: 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 998065750 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Bright signals Peak per Window - MEDIUM Coding Problem | CodeTikki