CT38796

Felix and the Lazy signals

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The council of the mushroom groves of Fungaldeep pays by the answer, and Felix intends to earn it. First: the full register of signals. 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: 2911 2902 -478028827 310823086 -146384241 -221434569 -979894833 -704360448 -275707200 524485780 152960573 646512054 564163104 312117474 -194505324 957041211 402199376 160386508 872330363 360133799 345414438 484258908 220629339 144874300 -747319713 855101827 -45908594 -900413329 -555445294 -919672117 460256433 -367901713 222073550 106286286 965546246 628803933 461140311 249328035 513346787 976220736 -610478103 -174586090 705008048 422280988 363251428 770586470 374079613 -842127548 968932383 81950035 -549551487 651252604 668170951 941460168 -549834916 -813910067 553494873 -786256710 -242500018 -898271955 547193063 738970083 217866420 -593608216 -993853097 -293112079 759124862 958866428 -852757300 -660052322 -342329291 -853625493 345680114 19323480 -298248032 -260860691 -488534612 291601875 3…
Output: 999574371 999574371 999574371 999574371 999574371 999574371 999574371 999574371 999574371 999574371

Example 2:

Input: 1401 1134 733352649 490133783 -143069638 -164559850 413224006 839765062 340262689 509652391 451978120 619461354 -652401180 -964332089 348555217 -975017834 -547705909 58638131 -177166540 -332119704 784535033 748409797 416474224 334655482 973788474 -168384690 -234593869 -303125158 172653517 380442981 -516137428 825650469 276591376 -110892429 -85541424 -692848144 -456196385 288659897 803826740 -428278455 874364060 -710671714 -836231960 -48176942 530873011 -497502714 -870303184 -652652574 343491497 -769015255 -4916970 562553144 -144929108 668048079 -237918331 -343165226 571319115 -277451483 -203608281 -278072582 950735318 614947249 -688362035 517419171 123903809 352978487 -866491610 -50573048 -155982083 207449609 -258709601 -117295342 644105543 544444153 -50059066 236149157 729110900 -65251726…
Output: 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 999905769 …

Example 3:

Input: 210 182 -591222411 -328932968 841956107 477051875 276078363 560594669 56619614 -475710228 -96728226 -421018092 578240749 776824659 7847231 506408137 545787396 941695927 34948057 -562995182 24874076 -728989525 503228698 -631855606 -559652568 620401478 -481621618 -465714318 95844440 202588492 386135688 -388049794 -422469335 3546509 901147326 -290097085 927697554 -673571693 -910883782 440348024 75638406 -429818931 876329035 -60924670 581999618 -605040688 6614541 33491610 945213241 800596149 -693324150 334276226 828487634 -822679306 -374822033 -814835804 -362332411 -666788893 -570321162 -454114976 -38040003 -1834326 796413514 -17883850 -950963177 287942690 234897315 43762728 627010991 647102070 329851378 -845764385 101270764 -96626730 -478440007 462089475 -248153253 867895753 581216576 -214135…
Output: 992479850 992479850 992479850 992479850 992479850 992479850 992479850 992479850 992479850 992479850 992479850 992479850 992479850 992479850 992479850 992479850 992479850 992479850 992479850 992479850 992479850 992479850 992479850 992479850 992479850 992479850 992479850 992479850 992479850

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Felix and the Lazy signals - MEDIUM Coding Problem | CodeTikki