CT39033

The Vermilion registers of Peddler

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Caravans arrive at the salmon ladder of Rushing Falls with crates of registers, and Peddler the customs officer 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: 1014 108 -684057099 40373152 -504378996 679465169 -261255681 -820649955 -886549685 -749876255 758936499 140939731 940216203 -360731572 974201857 306145751 350842979 989321763 433701460 492661739 997745840 320838804 969947343 -631236376 -678697154 -126606582 -376839271 706268067 911497705 -71017920 -80468096 -559053810 912354831 95385808 -82560758 -313750525 117414173 434496164 -98057987 445263443 -313348924 78573913 613313139 -215288430 -512681709 -461133879 750346028 -332904795 -768680836 -840824829 -136827985 -629426548 875381124 93164409 767843403 -201349424 -533800141 82338848 -140454697 32525608 814633970 827743910 405252292 471547612 360149914 -27002065 -854461732 977159177 -166527133 -929964323 483287706 -244759588 363078046 165723655 -185554957 898426064 -800674939 -151202435 18280…
Output: 997745840 997745840 997745840 997745840 997745840 997745840 997745840 997745840 997745840 997745840 997745840 997745840 997745840 997745840 997745840 997745840 997745840 997745840 997745840 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 990100258 …

Example 2:

Input: 2180 1049 -319922042 -730573480 700034191 -981731146 -735862546 166527414 -77595541 -93306001 -542759011 -246651909 397368268 -834944190 108726915 207851602 766602850 853273733 -694294980 -543756746 -42958125 -885895677 229798438 -737096413 830382311 -934483727 -830937097 760530273 691071555 779315794 -442622350 -166839112 811567123 130541166 -502547548 -52400621 689255551 812781809 -539171400 -787141153 160218750 -455988003 141364552 -692768138 -159314353 -913508245 -950212803 -335274241 841930839 9652488 553182283 -59599111 -563065563 519196567 50219315 27073651 598943007 -205076583 204628011 -289902059 -928734328 33810521 835224423 438083801 -514903631 -329887772 -670970281 -23273145 318750024 106143802 -752540162 202530425 211374753 -808679963 -788565281 -367902040 931984056 812122731 …
Output: 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 997499523 …

Example 3:

Input: 3690 2366 12905532 46361132 477440978 835336954 558628466 573093367 -54681263 -105062959 -943913052 864503422 535894040 -74372798 -336951559 263833174 942158632 -788090861 -580039737 209042158 402256076 -776794860 663300212 -824503810 747178191 133241393 264947694 665055971 -808012181 -293151172 -258664896 -73331694 624208574 -258378272 -383245978 56005900 -810777711 736007635 48105981 754615430 -246477314 -620068466 -999315498 -388206811 -864848849 -345032009 645812201 -496284499 -704879770 237107513 -793606643 671379172 68346296 924943474 -904525091 395743168 -965642341 -312544568 136416792 -814290082 -195912905 -900236117 624821698 803585069 886504237 -856051118 137353191 -610142949 -56734913 -263201668 -688509299 -882180604 821373850 297341917 41653659 276346346 -789195296 -115834361 2…
Output: 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 999966372 …

Constraints:

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

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