CT59496

Last signals of Vigo

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Legend says the vault under the frontier camp of Duskwood opens only for a perfect tally of signals. Vigo 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: 292 102 220399339 700540847 178046907 -348049296 416393869 54376355 -629245535 526838114 458681271 -82329764 -248599560 731634587 875859902 -637123686 235777192 -525785784 35033117 -897917905 9011803 475272773 -714232021 -333316246 34482480 45418123 98721458 132482084 407716308 474228080 -894993127 -462898485 -117896400 -783877231 554327223 -997119248 -609857207 -316632601 318335924 561894248 -468152562 94773367 -930722740 21498163 987214263 -736250353 976964520 290065609 162807683 425600230 -951120949 -919025496 -549438653 -162881194 -455524342 46912709 -104442349 -340095635 474721169 762921441 498089192 -978498785 -705602581 -993630106 -57100519 -11257678 -252575561 753755032 679753283 -332640550 123166558 -179746729 -470420072 -594945213 365831591 -653665777 900954805 -208669511 7705560…
Output: 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 987214263 976964520 976964520 973000070 973000070 973000070 973000070 973000070 973000070 973000070 973000070 973000070 973000070 973000070 973000070 973000070 973000070 973000070 973000070 973000070 973000070 973000070 973000070 973000070 973000070 973000070 973000070 973000070 973000070 973000070 973000070 973000070 973000070 973000070 973000070 973000070 973000070 973000070 …

Example 2:

Input: 1261 815 181976864 -605214142 -444961932 351963280 596477453 17802776 775833766 -790077791 -811610732 -382660471 964742789 -514672795 -111323727 198865169 82582710 286648432 951178290 775039448 347599757 -679867215 856692225 -719378456 462929869 -543216935 652012885 678855881 199225866 804697460 -453123871 -554665293 893172107 434364577 959382063 -93028300 -332192544 -328673842 -812324118 -710307554 -267722038 -15348142 -442742345 -117561308 -161347105 16792377 206254214 233213299 -653700586 338218758 808256437 901732117 -361509398 -264919883 -315335731 892955401 -833629073 -550696164 643775294 -414994911 211029462 -996750053 -933413098 -193775623 879137628 490475899 -907230662 -570821026 -595174151 869982898 -883263038 -368879457 27420560 -895586218 -460801465 176939645 74031916 -52314028…
Output: 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 999550325 …

Example 3:

Input: 1189 989 323564485 284724150 779891865 -32584346 -336743211 -647921768 680148195 -799704413 810814318 255582130 725571116 -564030364 653629730 -870464866 922399747 500584853 -276133655 -193581865 755696257 -272211166 -227419803 -856384093 878632799 -721179545 590474375 722631522 -378277213 393042594 -833014254 -703805139 975708841 139601337 -417396859 -86906584 -660836287 557358974 -488207993 509244504 -517558245 363970031 -939281157 498602688 592787303 -451871458 291591928 392124321 832949204 -229933386 954803763 683272251 -163266792 157361028 620686872 -179535467 -2389486 -796791835 760227016 -722302367 -988744475 -494982364 -794231492 -647565205 429748583 168641732 438273791 875912324 350470633 -78081866 116380010 -546425698 400824403 -735525480 -167058561 -642389547 -935003460 -2282974…
Output: 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 996775188 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Last signals of Vigo - MEDIUM Coding Problem | CodeTikki