CT59124

Sara's Ledger of signals

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

It is audit day at the railway depot of Cinderline. Sara 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: 3886 2715 261724562 312035768 745234984 261918433 256432983 -143862890 259625516 596142796 -79330356 70890514 -838364917 863807440 -224012387 -463749681 570930212 478257740 -481810984 -471846321 -214019736 -627431146 -536627099 531901571 -508747824 -761673004 951012946 -478794360 -376833022 396633395 163308711 -427202843 -160118025 561911032 -716426919 -391711889 -5356372 -100703441 8655731 -68660407 113754012 716184699 235210436 603972481 -750842826 3660445 421572674 860535941 448081096 -364299328 -237378389 -875715291 191320060 359844221 -651460043 -648521601 859788448 709713749 -264269101 634034861 -682829863 405333091 -726061777 -322568438 -996174717 215357217 -72322793 -380221080 809880323 435695630 236469164 -594195059 735701530 -370028644 671270958 -677265165 -609892627 -368987672 -…
Output: 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 999984188 …

Example 2:

Input: 3257 1526 697254798 823490897 -269039803 417513081 994165714 -870849986 917360230 -446416434 -402718534 -904190099 249460397 -958140199 -330312971 -449908580 982200300 -898434680 -736618080 500299460 -114278534 972943138 335493960 -321764141 89986456 573346616 -7532049 -538112461 558554808 627029478 -312782079 -795177803 467600326 179219856 -916477895 370192795 -878912800 14964242 -592598038 391366646 -696290763 896175096 90712312 786890472 -27760652 -606696913 -135905377 -585925316 -264452138 -849495284 977029734 673608784 32708636 733976330 868973068 816921051 254348905 -330256425 -447223541 368594660 515385102 -805384020 -946652501 -70832905 -477716035 -926205559 -739800826 184978296 870244644 -175001229 -525241689 75494309 -850089047 -129017626 491206299 70091723 -625750782 815998300 -…
Output: 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 997964798 …

Example 3:

Input: 365 223 414575277 904979629 370800503 -119662915 -968718662 282025118 708306569 358945897 -890050770 -44057868 182901623 81612428 125192265 972328430 706444526 102829763 915399322 963547182 -775329563 -217966985 995062768 163280922 666566621 -790740880 -307366229 -158313549 552739121 381485707 81915472 393991298 907294329 265103148 -587910543 -16068403 -361478415 -813724886 876674519 -358045547 -357714692 -860808034 -47226368 -981317027 -269515315 -461780473 529167998 -200032127 595345210 705235144 961169230 582771193 151110467 -31402117 -691235448 470843212 870518035 -723592957 -823048337 943234342 -479641189 -15500432 -181414360 427103309 -836325762 500853409 -271073497 499576043 -217577285 227615197 -286583663 72206669 -703873556 261528113 584673251 772752283 -716494088 -214473021 19750…
Output: 995062768 995062768 995062768 995062768 995062768 995062768 995062768 995062768 995062768 995062768 995062768 995062768 995062768 995062768 995062768 995062768 995062768 995062768 995062768 995062768 995062768 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 983123364 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Sara's Ledger of signals - MEDIUM Coding Problem | CodeTikki