CT64227

Opal's signals Reckoning

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

It is audit day at the ivy courts of Vineward. Opal 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: 2541 1136 -235484157 136180895 346869292 -537511940 45775014 -141381599 41068326 62166712 -464387222 -97709967 -176311534 991706093 489363951 -763753746 -861867026 -681483465 -486074434 553146970 -789514422 89532875 822440881 -117871737 92024108 642315957 397477346 -803729070 880418217 427065498 367297277 280064432 -7928654 -495792611 -702537748 62495437 173500491 -20553127 886409538 -26685584 -58121975 240901576 -116697943 46488291 999498663 49685937 753845367 904442172 192237737 780690522 124649268 -507315570 333744239 -880576173 -265147696 28120002 -678262648 -801234693 -223955715 -661324510 -27946430 -655454998 -234513142 -974684626 -456207751 909495715 -770104463 -393202558 418421993 657448690 138850216 -323670011 -457339364 -545821684 -614946026 503163476 14432837 -431453706 -1000866…
Output: 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 999647357 …

Example 2:

Input: 2696 2471 -251957854 796136111 -615258267 853035251 -778735377 -460269215 -940004882 -539321611 -245196605 461156853 -997912728 834194873 32007060 -40041179 664436611 -736332452 331535425 -966200716 284924633 -308565286 -239436377 482546371 -437689264 -684537239 922977519 675007296 -187555929 11035256 970363028 -60037895 596608347 613755026 -599931898 -220278590 -609281415 -874832791 702064372 -957306614 658043117 936490120 -381077254 -587376607 -590752773 558232857 683273063 -941442694 -375036354 -690690109 -401554680 -346396283 -770494272 -709671109 812120294 873036878 751011050 -545762403 -609169788 498667484 619441175 -18824372 724062976 817158109 -495850535 -654430435 -968646670 -613338860 -774735876 -706022222 -77033594 563853569 616125518 157681577 -287716810 -761507058 992939466 38…
Output: 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 998149197 …

Example 3:

Input: 2988 1043 -431162434 352860179 656507363 -645719855 -385140428 -328842087 -187719444 -883547377 790307285 943559641 -511375372 -465949015 743136411 -459936561 917204676 326806419 385612739 -65981850 -170141430 670264894 -90821711 -909389976 -787073045 -52484697 -669920067 763567171 -536134837 905235013 -977714658 -612244338 -934190349 579493062 -998951766 850054203 -356212834 -793059945 -246461452 583680235 724322969 171249835 521032712 -772749339 716570600 286279625 255503708 128859810 146770032 -118889548 619854926 840870750 -399211750 878902132 353065244 625724874 710269559 877153796 -54626764 746488465 712198497 598512420 -817168462 741108184 -924047294 718162227 694937785 -719158537 -57494725 772551079 110288455 3911922 -430805257 -251343673 -559433399 315728607 -840712623 356313711 -…
Output: 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 999250671 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Opal's signals Reckoning - MEDIUM Coding Problem | CodeTikki