CT64681

The Prismatic Peak per Window

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Cressida runs the chandlery at the temple city of Sunspire. 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: 718 324 -327158194 -761945048 -158023964 97501356 222574730 -874243760 775259596 -881666235 755827506 -957653544 -145020621 601209924 111794321 177555987 -388770503 667169679 15149057 499184347 572896051 -754487582 -308325726 -377569895 204128085 -600713185 -890416941 445176397 -434353723 292062192 88800762 -480219366 991642359 298725034 794806940 -44215001 842054025 788574296 320397958 409583485 970922560 742110149 155451543 234247936 538597482 492061323 875782417 499694834 -23146768 245158835 -208396335 505094237 695411266 38004020 239454851 787524099 -670278030 348367191 -83359517 44782969 396503851 63966725 -822253366 -131888112 814577177 -185104588 -492786418 -323340835 -111384253 514221481 -116728777 42077927 83693103 117132401 -574902631 -973942644 -253316756 -807931583 -609462638 -…
Output: 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 991767054 …

Example 2:

Input: 2684 1206 647822860 473578350 -611305054 636681712 -945496803 60612783 -696488545 -63702544 426246524 677991009 -441378129 964463513 -585246573 -512658202 300532440 278526388 892796595 734893521 210015763 -503283777 882291747 708701011 -734620334 -435964523 484786951 -316260987 -647930953 702004045 -80501621 868568241 734390278 546759065 218074469 -76741498 884342051 -679008686 559721481 406274191 -551264155 -116587738 -7647711 75871701 938351263 587639707 -1137058 527257924 124956092 193743166 -496185088 -170912207 -193320210 -141517521 -710721779 312315826 -549205531 336904814 471613326 823440342 566678426 -203470469 -973879036 884719647 198929935 -17316806 607168560 88849720 -919274155 -185490211 545536122 61862005 323166755 982380062 764389634 909572434 529069943 979283656 45982937 530…
Output: 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 999667347 …

Example 3:

Input: 2367 1423 165478432 479114417 -582278611 -593418573 -828382488 -78920625 -41849378 -719458121 -928420595 457225929 669653803 98751689 755712954 520903452 -360573895 -774948065 474972177 448696705 -132579884 -599827944 -407289967 -626340322 18742768 802715942 -539997745 -999319118 -447898120 942308 -858290875 87110801 271226918 167473665 -801510863 212817064 -575442087 968048027 -421807200 -445657237 -763887159 630733650 -698896121 184519113 -193969004 -512967771 -787749873 721149217 681824472 250478898 155688386 36010663 660171452 -400086449 -849687592 575676543 383274241 651001786 259885548 -305110300 239559034 265916733 -355503921 -812869058 -772577580 -878183237 692495058 -150286577 676593801 892277825 -530301509 352644399 615614150 -58751785 554119797 -827308819 -132187959 -916586311 -…
Output: 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 998137877 …

Constraints:

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

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