CT49700

Sahil Counts the marks

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

In the basalt cliffs of Obsidian Shore, Sahil the scribe keeps careful count of the marks. rebuild the damaged itinerary, every figure matters. 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: 950 579 -488646563 -872160579 567133688 -703177447 49432024 932516837 -347640546 191740622 -755645302 -727845775 -192901957 243905991 -784482771 -34435549 -356958789 851231217 -317161480 -11124473 804821396 583860828 533619309 131436831 908310853 171343822 -700551718 674078711 227940609 995214645 -700219464 -98505324 -361602509 -494315763 725384756 180031171 702198213 624277119 992802637 -238876828 420957912 837172298 -203159765 833097840 -65033394 783914043 -7184167 781981805 -744689363 -774010734 49662795 -484629019 -586867132 316177533 -349446454 -181028184 -139075937 604980873 -552481896 897518664 799174147 478860283 -466512344 -243640622 319204866 -293460761 -795219977 -14131877 529546034 76925057 469233898 -993200858 -289061251 383789851 292490607 245809190 755869254 -479520277 -4306…
Output: 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 998059216 …

Example 2:

Input: 3242 1884 -261710769 -929590755 309907416 138422145 183192674 652259043 -763894693 -870907263 511833413 -738201302 411968829 -953863643 822704561 229182770 -883113095 141139714 852464188 -412654869 196387165 -69320474 -707565814 89374750 173863465 296755822 306670062 333452939 -303431732 -616098306 -242615286 653592190 607007090 -842303555 -805920490 20737381 923397232 491247083 543953285 -149531996 985721415 471927877 -915318406 159046708 872523511 375940689 -890025506 931930504 -954658313 -61873049 930148117 -899273130 394818086 -387679235 -686541838 -105653687 784980005 130041738 -344801063 456211414 40764477 -472890921 -804563363 -833196990 -900693938 474115260 -198218484 204653922 239516866 957079251 511082520 383758206 104585739 711352722 956698685 -915795791 -319878947 770977106 -67…
Output: 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 998829167 …

Example 3:

Input: 2614 596 192168879 -550405916 695510946 945952283 696216079 571064096 -598828711 -379023107 993463637 969656183 393036605 477802193 -94189620 433799965 93744359 -120832663 -345427383 -286734005 197192141 997744540 -538011954 -849798157 751488204 -680562284 779866723 71000434 59191824 -872724832 567965535 -507999250 261949270 253892258 456243540 929711097 -583367338 -282714844 833874396 55178772 -99462046 -765159941 757952650 932870955 -318595411 -22019275 95724876 -249419918 -947087277 -880299766 -919850306 939125741 -155371258 -448664150 -434271227 969224916 -17143135 -844356205 956851823 890553319 -555882462 -629040089 -229383784 63481135 -269111011 666044853 -128226050 963289840 -812378199 85159670 336758391 373922119 -554071695 -946323950 607726247 146444891 -97002115 -523375224 756699…
Output: 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 998930345 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.