CT63964

The Sterling ledgers of Zane

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Zane runs the tannery at the rook towers of Chessfield. Today the books show a list of ledgers, and the numbers must be worked out before sundown. 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: 2227 1210 -817633422 -511239314 342768622 276525438 144654450 -645779411 -267647851 -738406904 -856469019 709030259 346651234 235635977 -74538561 233417267 689828322 -999261186 -952281 -130946877 -444371300 -351232979 -809612627 646779154 -818010847 207681586 67993642 -819681504 -255013469 82150916 513408152 -877778329 -412119309 882600120 234185491 641818884 -569496317 -668861067 -601833221 543434311 964190000 658411612 291515179 97151981 963266522 966549832 -213182582 -143239562 -204114290 2374673 261085040 -506970696 938968364 -612786057 -533147904 516049125 -117339174 345343726 -746853893 -629821107 -559967885 833121640 -825270761 480193638 651074850 602265575 541256625 462251018 -920357475 -646661754 424463548 -329698412 -415288288 109612093 -89328215 -402543200 302492533 634443549 41…
Output: 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 999794158 …

Example 2:

Input: 1905 1421 -847980617 119804638 31992289 -172365253 614335087 836538700 919101814 367367780 -411881925 -450615727 -774992571 709668729 -661132917 779369264 947507067 -361783949 296318829 406296825 861736830 -92973095 263618411 597239323 -510395187 -615784227 -460073900 -855001020 -478834882 -204110091 -490567105 540176652 -361022441 -392078592 257065684 -446460705 609785540 -674909285 -650178527 394327800 -233132347 514107135 180330207 -812241437 -18649632 -515587319 -631339930 -584143160 264340602 -400755459 591849184 539670860 326230585 -700755277 -841566147 -482671685 -926206493 371228537 -365016379 163407087 371569335 -185847834 -606169185 -194710102 141598593 -346975783 189231339 -974472759 97302289 23195108 105314804 153624965 900010225 871742224 636377255 465021026 -818651775 -751098…
Output: 999600697 999600697 999600697 999600697 999600697 999600697 999600697 999600697 999600697 999600697 999600697 999600697 999600697 999600697 999600697 999600697 999600697 999600697 999600697 999600697 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 999906372 …

Example 3:

Input: 3698 1300 -175162303 -74628445 331967956 -865745874 -754437031 -25080559 -994589616 138325309 377810588 -423066948 313542032 33762757 -838544240 -631651389 -986114992 357581252 685395841 81576595 44333927 95055928 237259180 169960640 609292466 -728716699 200855322 192405777 -363671643 -16273728 384131775 324683062 32982293 719021059 626883316 -733357239 374568503 927310 -768109018 -706919188 163110528 416139567 583703376 345656862 -510730826 676584066 202885303 913670638 693747305 390770116 -945645473 980215477 860943495 972245178 394039216 -554745607 654927418 -465902377 -971327874 910534217 -758637841 -304346258 -803369596 11549962 -41365542 744262456 -590696074 751296344 -309305007 197263658 915100847 -123937685 -3851223 441533413 553797862 461005918 -273962401 -472609517 64007418 -9278…
Output: 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 997962958 …

Constraints:

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

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