CT63861

Tailor's Verdant beacons

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

It is audit day at the snowberry thicket of Winterholt. Tailor spreads the beacons records across the table and picks up a sharp pencil. 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: 3747 1390 -519554800 487886175 -675017417 636315842 820717089 -515881497 -933512655 904105688 -53163191 77105648 -857153220 -73703652 824094080 483539252 791758137 686384846 -815534767 450632367 965293766 -426807611 -844738524 -991034772 796369547 697014824 986402953 596335263 -602423009 449851622 -536137069 271095172 55583836 609705026 723528461 -542131291 747473234 -210780023 796217334 515074296 -872531215 116944037 -98519138 -621962030 316446261 -460037167 373762731 -303354444 -101645586 -383425448 563169220 -874831395 -383517354 -68822373 325355859 795019997 745171250 868440612 -686290788 -972205464 502961061 780054404 -195363361 -226513957 -175237738 289891000 -848929140 793409934 -107996968 828306679 192031948 990612331 -746708401 767033301 -470528495 624391579 -984017232 992533264 -…
Output: 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 999223792 …

Example 2:

Input: 1259 1194 -877507968 355632684 -49754256 835009535 -614043498 716076342 910980573 800177929 -83176793 -351116095 979575365 -378773356 738671050 13620902 -999485760 -370979861 222818041 -284070840 349231726 264752967 142153745 -927290957 -639581485 -478204195 -748875097 -335851655 936119453 -646997471 442875195 -109625902 4076208 -296104675 -371906199 -246290476 677180346 -194250086 897276198 579709614 937203352 55755167 807306737 979121048 -325069556 -934747098 -99477626 -332902540 -677837042 -686125721 391359561 -854024030 443466882 942096817 425265022 711888987 842040093 -560411257 175169152 -511722035 725692572 -990636674 411770372 685250041 599810906 261538443 -687150471 507637275 448003718 -694373033 614318258 782092602 -436017547 -526935799 666975292 234664664 337069267 -865300441 85…
Output: 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349 996976349

Example 3:

Input: 899 16 -238585161 -538398980 420497286 -197069763 -412753299 967530906 -670644079 808084761 -560765345 -411666368 -753808859 263760156 -128880707 889529611 40889422 -591749686 73147189 438778327 443053042 -911235598 711565108 -963132133 926643287 536914404 430553539 -579145557 -292077534 -674678482 18180842 44783048 542604153 223457585 -588106679 -294846646 244645583 241358716 125041986 885759941 -101515280 35917635 -131860145 542122829 206509455 -294515207 768067398 563977926 -293249102 -248247740 116703574 -611924125 980748223 -70969909 419515193 -731753023 647546268 903416605 289309894 972814788 752154368 -248946167 -342226358 831399856 -123501764 -896988160 -219434999 -36749088 -505989459 -230048348 877302948 11071352 840729253 -440999936 771402656 -405943936 158882822 -994482350 83702…
Output: 967530906 967530906 967530906 967530906 967530906 967530906 889529611 926643287 926643287 926643287 926643287 926643287 926643287 926643287 926643287 926643287 926643287 926643287 926643287 926643287 926643287 926643287 926643287 885759941 885759941 885759941 885759941 885759941 885759941 885759941 885759941 885759941 885759941 885759941 885759941 980748223 980748223 980748223 980748223 980748223 980748223 980748223 980748223 980748223 980748223 980748223 980748223 980748223 980748223 980748223 980748223 972814788 972814788 972814788 972814788 972814788 972814788 972814788 877302948 877302948 877302948 877302948 924677888 924677888 924677888 924677888 924677888 989299658 989299658 989299658 989299658 989299658 989299658 989299658 989299658 989299658 989299658 989299658 989299658 989299658 …

Constraints:

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

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