CT61737

The Peak per Window Beneath Duskwood

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

The harbor bell rings at the frontier camp of Duskwood; Seth weighs the day's marks manifests and starts the calculations. 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: 3066 2718 864364061 -184134252 -190232089 978147120 -922440301 -678586018 741460305 408109172 -592922650 710336952 -640294080 -555105288 -693046641 190468491 571235726 -129323776 656515551 237858513 -175837631 603651059 163747513 275525666 198661011 -187846082 362215010 -339214857 -7868985 235518707 840691010 452507948 -41975242 -979580528 -831668242 -10581801 -568384013 -873646854 695142490 -90415112 -743328347 -12090014 -461566868 891519139 -779960073 71677235 -247222123 15535772 -140898111 596069304 297804061 -411080982 -831710743 365630954 198019008 -57896311 -936394970 90857784 262938252 989541336 659431173 281965766 978494334 -985214282 -890900523 -755410173 108041840 -875522779 929981066 -752286787 -649422707 589441232 -889103361 584987197 -27101634 -412443178 186823267 142235795 39…
Output: 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 999967812 …

Example 2:

Input: 144 27 -952042875 -257071970 -646003554 655855573 -888123774 961300483 -140287572 -856204627 617707276 679101172 845222795 622218560 989443085 390335085 -604503902 192497563 -921302896 -206665243 -915834180 504506934 97735333 231647934 847026253 785077858 -221145035 545355859 -217588599 -707284193 231774804 -622344082 213236924 -354098929 -584988023 305756541 604072731 -109037418 -838634183 186830830 -521615453 852133474 -470180338 -873504042 -971328853 681197529 815316190 290924859 68168173 765178912 366256812 -987992176 549286915 426406934 914706563 83733038 -755040341 -863094116 -74208454 -948782375 -241989500 -577015006 -982783948 -319618268 808071574 240609875 -536681335 602069374 317395677 109168 140694912 589235528 -129819373 475584868 -882254532 -109782702 523639454 -540047078 -776…
Output: 989443085 989443085 989443085 989443085 989443085 989443085 989443085 989443085 989443085 989443085 989443085 989443085 989443085 852133474 852133474 852133474 852133474 852133474 852133474 852133474 852133474 852133474 852133474 852133474 852133474 852133474 914706563 914706563 914706563 914706563 914706563 914706563 914706563 914706563 914706563 914706563 914706563 914706563 914706563 914706563 914706563 914706563 914706563 914706563 914706563 914706563 914706563 914706563 914706563 914706563 914706563 914706563 914706563 808071574 808071574 808071574 907324246 907324246 907324246 907324246 907324246 907324246 907324246 907324246 907324246 907324246 907324246 907324246 907324246 907324246 907324246 907324246 907324246 907324246 907324246 907324246 907324246 907324246 907324246 964303568 …

Example 3:

Input: 2668 2448 -589489004 -452611099 58033968 -934155737 -813181163 -409000301 -438648477 -793261585 -633309233 637354060 -455734632 58768506 42823000 148041873 524498927 2221492 467929867 -387625164 519905209 901561671 -437075737 -585298768 4733542 -72459879 171352387 -821243647 -194456588 -450562259 788183979 -696150051 -253898841 231739252 -289564521 829784065 -215430608 -171837847 299334175 719832054 383824023 -257688579 956742701 -205723512 -408264184 123709999 -932260661 574355842 -597295289 863734401 -155576144 877502492 -109544997 160321116 201811526 316839353 -57961845 355780276 -240630408 822181533 961607090 342425631 335000013 -685295305 211929253 499883589 -358163981 230158437 -66453454 -68494289 864293830 -249415033 -801919807 -380475135 181008619 124771262 -258574198 821881338 -40…
Output: 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 999420821 …

Constraints:

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

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