CT62544

Elsa's registers Peak per Window

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Caravans arrive at the thorn maze of Bramblecourt with crates of registers, and Elsa the cartographer 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: 3113 141 153088092 627098800 -587919063 808294346 -883174563 971957209 -649219668 425900888 -22917120 -636185634 -768135334 -847817512 -723632971 -682047917 -202696857 75058637 -748163347 490516015 971656454 -582545191 -738805866 958637730 -765590187 -465591294 487507204 -946452514 -928484519 33463218 -381704928 542830402 495550356 966063015 -127648182 -89508724 286994710 875512763 26158449 496878718 461118100 635155655 106435582 -330802732 805170810 917233816 -935296649 -628048988 115623843 809379776 -694165566 -503635719 74695561 253110667 -426854690 -661059287 -38479815 420799469 -57033548 123740280 111932313 296460391 -934489699 161873363 681104775 -764405170 391571421 -416785510 107248027 167928209 361128800 -329730326 468418884 686026587 702259868 -746695143 367295759 530109504 -2380…
Output: 971957209 971957209 971957209 971957209 971957209 971957209 971656454 971656454 971656454 971656454 971656454 971656454 971656454 971656454 971656454 971656454 971656454 971656454 971656454 969738955 969738955 969738955 969738955 969738955 969738955 969738955 969738955 969738955 969738955 969738955 969738955 969738955 969738955 969738955 969738955 969738955 969738955 969738955 969738955 969738955 969891037 984171112 984171112 984171112 984171112 984171112 984171112 984171112 984171112 984171112 984171112 984171112 984171112 984171112 984171112 984171112 984171112 984171112 984171112 984171112 984171112 984171112 984171112 984171112 984171112 984171112 984171112 984171112 984171112 984171112 984171112 984171112 984171112 984171112 984171112 984171112 984171112 984171112 984171112 984171112 …

Example 2:

Input: 3563 3031 34226391 446521049 953803501 86388832 836870334 267641297 -944579806 -108567329 -115171756 83222596 543990120 -923162233 -624295530 238550787 163968464 25825009 192594203 -666702228 -777469199 -237485859 481854282 -553459281 53867163 329951037 -562908822 -688221608 31011761 -5993337 -424809570 726683510 -552694022 -142549846 757224863 -948316010 -945301026 -155751305 173359707 906025873 213806789 312414562 36282618 -323910009 821355397 -870238532 -943593406 901773178 -428707896 726101819 -847498724 -699934480 -348618485 163061473 563454753 619702012 545494712 989545466 -303110030 991607698 -940110084 990811957 166234329 -694120817 -443226511 70632285 469280339 307685584 665439227 -609455552 318934987 -17630745 -181303640 -818098094 847927707 930393271 -362326968 77382923 -4069735…
Output: 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 998857469 …

Example 3:

Input: 2346 1626 102372926 -68562155 -279057699 822372009 101192585 155360427 -945065677 832548829 305191331 489210036 -469821845 -695288200 -787135084 192454959 53960426 565833045 111370499 529969352 465375140 -194470736 -440076599 179613965 461193348 580627148 334497961 411818240 93972091 -400531992 947860177 255518831 -292656579 919854270 -309671342 -854842367 933068158 -318222994 -55582224 -527004092 -576839731 -411802484 933873329 110986172 -790632116 514552030 -486323258 983768385 54802973 800627325 721338256 453450415 -670001126 736287168 934327492 -442635984 294502164 -805917180 51525538 883658749 379365596 -560788621 -160774749 385911298 -49523475 -391542055 -738171396 825660856 846932124 -484372219 727535191 -769365268 8076377 -487975805 664863244 -148306414 991462157 -604425549 8426723…
Output: 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 999724150 …

Constraints:

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

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