CT64579

Dev and the Prismatic marks

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

The council of the shipyard of Keelwind pays by the answer, and Dev intends to earn it. First: the full register of marks. 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: 1239 665 266256921 272091632 -993699357 460278203 967981008 -387403951 75660806 -804012976 -658613087 129668778 -39603035 -114268094 894730392 231989747 410161818 127974528 671852092 -484040046 14164662 -86719942 266358937 961006216 -905523986 -547002375 258869545 -175505303 -848577905 -507237744 318476529 -389320593 -229225441 -156993356 128912903 539379876 -304471132 -374423273 -608011059 -214347553 -86930323 -155794674 -760328460 -759216431 898687985 -504648025 163354167 -364374891 -490135892 -995399957 101910792 -949392469 406233456 148647692 -151555683 810780686 -53274761 -131745568 -440821454 551095162 649401834 546651687 -996617717 149786557 313016357 361849779 248725689 563335595 -505456014 -883203568 734989802 79038478 856045039 -806104840 299629669 -31978943 -452032361 887300473 …
Output: 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 999581585 …

Example 2:

Input: 484 104 -491027795 -646979892 965990946 -894596341 672174888 -652911975 762434682 480272958 265717163 188012028 970587208 489999182 -299154310 -196516863 476916379 810663063 188689522 -264301733 -444527483 -127386772 -169180109 -16454384 -575125099 490446772 -318070002 -662325331 431804838 447736816 803616026 -624740187 -690844394 223337510 -658580247 -615186635 -892842931 31724316 -50693080 -179827362 433155947 524864076 158606007 -254222385 132342942 -83865499 -788936619 842998409 338537762 313551860 320401466 -618769223 460483943 -121703679 -879342935 770380309 -3143863 49960269 -349662145 474157391 -462729014 -758673955 231259219 -655532231 759730865 973434444 853287237 -430752217 75239934 -471763797 -132726221 -651272000 639346535 103626764 -329753055 -58094979 -87354649 -541886528 -3…
Output: 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 988264861 991128032 991128032 991128032 991128032 991128032 991128032 991128032 991128032 991128032 991128032 991128032 991128032 991128032 991128032 991128032 991128032 991128032 991128032 991128032 991128032 991128032 991128032 991128032 991128032 …

Example 3:

Input: 1097 514 -648908684 -266865272 393013445 884968446 425387826 -642319554 169394708 358210119 197721149 -597854280 -554109594 -815426604 -888112467 306035785 131601275 -54673151 -545519825 -440113566 994356143 991082911 -154702140 -418353051 -294640329 758291142 -295114892 -707421742 -696095819 453416672 -704274287 789260853 -667305712 -450443563 571618920 -996778632 -965510108 -478100245 913964754 -521380064 681210371 702587030 -814927848 23473072 367914466 -324451694 -237489680 -562139383 -487940208 312379610 -628265348 -593112315 -926908749 46060411 108775928 -253293777 -517954569 823477892 -899991150 497961117 728543805 -549466030 -307712255 799120139 233896055 -635747924 529233438 613607729 -17466006 111031845 -266844980 937932102 450510537 389410603 -99673783 572905555 -636312058 77175…
Output: 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 999752506 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Dev and the Prismatic marks - MEDIUM Coding Problem | CodeTikki