CT51565

Viktor's Violet registers

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Caravans arrive at the gull cliffs of Screech Point with crates of registers, and Viktor the factor must account for every last one. 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: 1434 496 787057960 -282864287 148069039 692530974 227300690 14454709 594591765 -287564999 762767674 438005680 91263465 -518373239 499087672 -70747898 -800099548 -174903023 456643495 652154051 951112676 -412988717 -532192710 -254362332 429855573 476200446 -415615096 -282250649 884334222 563333825 -845955360 -489633022 -442240967 115262317 -198611483 -206223235 786691240 3441260 -346743450 -534609958 322285795 992923265 -392089469 708744535 61910385 -487835950 -486215363 639634298 672766970 782462197 -349162425 251376907 598800932 754524446 483575697 -386719353 -906629588 -645502370 -978448086 -826419195 -467735877 111001236 -348582926 -363457331 297909298 -615108883 28999396 312377397 -299704748 589086362 -722712178 -884434918 164099968 298008779 -716199181 710976649 -350945317 847969623 52…
Output: 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 999257317 …

Example 2:

Input: 3861 916 410646496 -332982666 -325044450 336618651 -69640513 643005148 -650440993 859650470 -645913557 -612226956 -84641148 -481259892 344382274 -390508960 -668596794 -725866751 944327167 -751424402 757733197 541609877 657275096 731429386 -430928365 435712970 991831116 504554535 -360989041 584581484 799334930 531054467 606210032 421424711 -597077140 -561452737 783791987 613751544 989370099 -334307045 718775759 469905356 -780999667 -144118654 334139722 306813752 257192495 875067273 -242972663 67748259 -219463685 113851022 -495089373 571458729 -663236535 143498356 -215089819 537396315 -431107725 -632613868 -96240830 -36629221 -504165763 -30235245 -981659686 698394097 -727102594 -984796783 -793967636 761358551 -792526753 773565144 -149957360 985603929 928139357 -101267290 574214363 -11765731 …
Output: 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 997324966 …

Example 3:

Input: 2360 2318 983296926 -201490754 901569234 -42735937 783593032 361973128 351368330 -750141007 -917726756 -932263088 269641891 -492559425 794078629 960805268 -834255826 -660358045 -914683146 -368223602 841190958 -73692218 -8154091 7974322 -739424923 999846221 -515527036 -241130832 994860813 467979612 38308978 586073345 748005597 -105705802 -737534963 -682010718 -968785530 -49709906 475467405 -122425253 186686183 -469712567 106666854 691170654 -424037936 -607861391 -308751705 448239959 960628669 750130798 889405419 791468337 112906035 607658339 -122167826 -733852510 -446736895 -103716886 294483146 152055526 990062655 -89376911 -342898783 597147307 663232022 148140568 43016865 -908037952 -649240733 702474805 -301200853 -194143168 -689087349 -713963776 -62530786 -45500306 -958516705 258221832 78…
Output: 999846221 999846221 999846221 999846221 999846221 999846221 999846221 999846221 999846221 999846221 999846221 999846221 999846221 999846221 999846221 999846221 999846221 999846221 999846221 999846221 999846221 999846221 999846221 999846221 999568555 999568555 999568555 999568555 999568555 999568555 999568555 999568555 999568555 999568555 999568555 999568555 999568555 999568555 999568555 999568555 999568555 999568555 999568555

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Viktor's Violet registers - MEDIUM Coding Problem | CodeTikki