CT60797

The Peak per Window of Verdigris

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

The council of the copper works of Verdigris pays by the answer, and Asha intends to earn it. First: the full register of beacons. 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: 2055 289 -423129378 160791037 154413102 -646540944 -434107936 157369606 216262802 -604094556 -924341101 -266415393 738662516 -839848551 -529296375 425182586 566245478 761835491 245710821 803776546 -329254354 -962324486 138135170 294598158 642226966 -499404595 574784910 -450152005 -114920047 -512484510 23486080 -54311315 659673448 944624497 257303007 -570194108 914588253 -475386384 682197021 -424264230 421327239 110444432 -493460732 -418022642 426337154 920884609 154338476 -392908395 642591140 31681140 -941198515 -87997682 170439411 386364864 160955957 -282911064 500170658 -544149988 -232198314 476436848 299630567 -936295791 43578599 -234490211 123050890 83792160 176356690 -865459939 -36773576 98421416 -943931727 738548104 866298162 -226066594 -44228470 781167354 354090718 348126550 8376382…
Output: 978811223 978811223 978811223 978811223 978811223 978811223 978811223 978811223 978811223 978811223 978811223 978811223 978811223 978811223 978811223 978811223 978811223 978811223 978811223 978811223 978811223 978811223 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 993693611 …

Example 2:

Input: 1032 411 -724914238 477480095 991915944 423497670 930536249 -695593991 683295798 625958927 686933614 613053663 -554547057 594198207 496180462 -128898946 445798670 -202950698 -928871179 390046661 805029598 52737041 -869658972 -741776646 -590241784 -514068131 297254265 133461260 -372600151 437254765 216890719 -163942447 299265883 55087868 921997020 835721583 490304005 892763624 -311544124 574515860 33125678 477961312 364492629 607851242 -566330596 -684012460 724458916 596667064 -356733172 179359405 863562720 691374614 954571122 500367093 -803740158 716782676 952165146 179952985 -266994948 -388947732 535940392 -445357052 480729480 76713305 465039668 -678274593 355147335 -829070732 -542884530 -832053855 655836187 745588878 -36872201 662878995 -331199896 -678849430 372612891 914782036 -12580590…
Output: 991915944 991915944 991915944 990139503 990139503 990139503 990139503 990139503 990139503 990139503 990139503 990139503 990139503 990139503 990139503 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 990376686 998145422 998145422 998145422 …

Example 3:

Input: 1260 329 492688307 243429699 845782956 186366863 -25815586 433301463 -34618276 -354792367 350504581 625213807 -315500509 260150827 -158425554 -933946817 -350134060 157481115 -536021356 406320499 221416069 -147600836 -506074808 -841014599 139976312 614284018 811541646 190532565 -849397321 -457691098 362854177 543792589 130444823 -479462280 -153681199 269889569 683814792 -673496533 996757547 -634098671 -794527946 837762823 352903747 -502979942 763890636 -631242224 248455515 443739784 -106243403 -598936724 -440918577 770886083 495417315 -927742319 709066810 434022616 255625178 878561657 815458535 210494203 955595432 686017432 987304136 -876992731 -972871544 -675973013 398430265 627575137 972190569 596379201 -892058631 985518815 492830217 -317051062 -137901660 -986043838 84360904 -181302883 49…
Output: 996757547 996757547 996757547 996757547 996757547 996757547 996757547 996757547 996757547 996757547 996757547 996757547 996757547 996757547 996757547 996757547 996757547 996757547 996757547 996757547 996757547 996757547 996757547 996757547 996757547 996757547 996757547 996757547 996757547 996757547 996757547 996757547 996757547 996757547 996757547 996757547 996757547 990662249 990662249 990662249 990662249 990662249 990662249 990662249 990662249 990662249 990662249 990662249 990662249 990662249 990662249 990662249 990662249 990662249 990662249 990662249 990662249 990662249 990662249 990662249 990662249 990662249 990662249 990662249 990662249 990662249 991613235 991613235 991613235 991613235 991613235 991613235 991613235 991613235 991613235 991613235 991613235 991613235 991613235 991613235 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Peak per Window of Verdigris - MEDIUM Coding Problem | CodeTikki