CT62506

The Twilight registers of Zoravar

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Legend says the vault under the tundra station of Whitesnow opens only for a perfect tally of registers. Zoravar 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: 1037 150 344519801 955459215 354141506 -763915437 850505521 165453525 -221938827 366299898 -166976055 330545239 491117699 -772980662 -573267399 -271113230 60640277 255901519 -619494816 627587899 -52961753 -548734540 479365652 296076211 -47842463 356496505 285370742 111985035 547464781 232383533 836055197 -115618343 -592921573 -157126022 231379040 -857967832 604447437 360724763 -7449779 359956077 875944276 -268513730 -661106551 -3896071 950125907 755468921 -826908871 277719155 713290439 -558896906 788977227 -660956297 811039595 -246990142 484767822 -491128648 953474025 -916259250 123501240 335054854 512997832 -668681881 327136366 71666557 -958209555 795396804 388788336 195970010 892884050 876671907 -867817813 442939479 425400632 -412727368 21872430 904593770 -889240087 270672697 -997071169 …
Output: 960206720 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 961975027 982565062 982565062 982565062 982565062 982565062 982565062 982565062 982565062 982565062 982565062 982565062 982565062 982565062 984895611 984895611 984895611 984895611 984895611 984895611 984895611 984895611 984895611 984895611 984895611 984895611 984895611 984895611 984895611 984895611 984895611 984895611 984895611 984895611 984895611 984895611 984895611 …

Example 2:

Input: 261 39 -253553298 425037526 -810735350 94913209 -773356904 -561120433 808791587 423348571 803104259 -423928845 593968828 -965883546 -87427294 -162469761 -155550452 -861431425 868028443 371408621 -962543146 859019856 202708420 -571589407 420794020 -27410768 802212252 -764293276 417420757 -930531960 970806718 842665055 370065745 317024146 -302917582 472751051 697659731 753380010 680323413 -20963539 -680430019 -239386340 -950311228 706332588 849218508 383212319 -810357568 584807411 431039897 -843020457 713697110 -72108534 -650236755 -32152552 325808695 532201711 550271096 232881217 -432440085 829644607 -33170424 911029113 -407799735 980971501 -36883897 323969817 43482218 -349863574 -361655873 289800657 -816864666 932595055 -35679785 -28797834 396496289 26111846 296857819 -638602936 -166252166…
Output: 970806718 970806718 970806718 970806718 970806718 970806718 970806718 970806718 970806718 970806718 970806718 970806718 970806718 970806718 970806718 970806718 970806718 970806718 970806718 970806718 970806718 970806718 970806718 980971501 980971501 980971501 980971501 980971501 980971501 980971501 980971501 980971501 980971501 980971501 980971501 980971501 980971501 980971501 980971501 980971501 980971501 980971501 980971501 980971501 980971501 980971501 980971501 980971501 980971501 980971501 980971501 980971501 980971501 980971501 980971501 980971501 980971501 986007147 986007147 986007147 986007147 986007147 986007147 986007147 986007147 986007147 986007147 986007147 986007147 986007147 986007147 986007147 986007147 986007147 986007147 986007147 986007147 986007147 986007147 990942287 …

Example 3:

Input: 427 249 159088700 -120807064 -364585181 180696942 -846286764 842168380 326609605 973050143 173838859 869694575 541751771 427526949 874292758 -159181987 876567426 937558468 -850333618 632597061 -66268032 -99659681 350402130 416285419 749335833 -268447550 619251386 -242992466 70943813 682294742 -77538857 -245519145 -463052990 -72876377 478230573 475012087 330471998 -46217803 -958648119 -515614489 129802274 258208102 802459971 -780005131 -326913446 -411472031 -962557405 527180129 -347340202 883994282 -412302073 105618594 -894866964 -620686995 105422897 351395209 -268203276 208997034 11583498 625831557 649144507 -947463303 -718533801 -326909653 259443003 -472881250 -276697750 -746653669 -40948936 -379162385 838678790 -245983378 864183636 299377466 -273069907 -665407138 578606524 88151566 -7944…
Output: 987239472 987239472 987239472 987239472 987239472 987239472 987239472 987239472 987239472 987239472 987239472 987239472 987239472 987239472 987239472 987239472 987239472 987239472 987239472 987239472 987239472 987239472 987239472 987239472 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 989180627 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Twilight registers of Zoravar - MEDIUM Coding Problem | CodeTikki