CT55802

Wynne and the Peak per Window

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Before the gates of the seal rocks of Barking Cove close for winter, Wynne must finish the signals ledger - one figure at a time. 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: 2802 1093 509716039 324486182 -310736382 -778626129 -5554320 510127582 -748239426 -593967174 682939207 828989175 -815757634 -431261010 -974251744 627435056 722302675 -380661935 -731062984 -25363294 84950814 568696877 -643590189 112266133 456547192 68787056 -868310521 -533669916 -916615843 -974079921 486597925 -436086848 -510212341 814847267 -39326153 163794937 -550257208 -952627093 896128060 50565561 -718644984 721106325 720409835 665920578 -798878033 683288674 -934464309 -503402634 674898414 282535729 -759718057 931049875 97056325 -990208254 -1263211 584953158 -19247881 427051956 -686722519 922650801 290887234 713821503 940666477 10565774 -73483967 -889918846 -697955510 -852680849 287693040 947463979 333158345 21827599 509510035 -570519250 746787293 715678800 418013401 -161639873 69958024…
Output: 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 998634348 …

Example 2:

Input: 1292 1086 -521893600 227130730 302447556 457131094 -494652714 -586095303 111463362 105812774 -293865577 -54772093 -199687167 736717126 -824478566 -409555017 85617292 207880911 3289152 294759838 -20973738 337001421 -486698734 434440856 -178124524 -739588710 361496834 -171624342 -926053041 -331909780 -987518198 578517972 97480232 -276057735 808384653 839617331 -332695872 -823091512 -469029467 -203898501 -10972994 -11194037 546428515 923732220 629104232 916268434 412911715 925694293 778113959 -91089390 331662920 654515269 -394340630 -29472346 494439038 -433950511 456950032 -51788917 191413735 -465183963 -168631879 -447025476 82413669 -422224296 39593577 126643319 670728470 -532186668 -353261021 -233099392 608599077 -862777739 747239363 -608599800 518449852 466056791 -968735118 944871853 68305…
Output: 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 998788738 …

Example 3:

Input: 303 168 142119271 -919196614 -91533468 -244371605 -959962345 6122578 -519233733 -301286621 -78080631 -264729510 518376141 788199942 176383503 673406371 574311930 716232882 39065499 154341913 476843639 312548695 -981612207 -459813414 -167996120 -956794381 -147605452 -302464183 669977593 711159731 935050701 -268542490 -258313959 -41215506 525743281 561519967 108788418 26373349 -130421139 -195040033 64613290 -173562851 643284053 -734139961 158151865 783704103 -555153932 181514004 647763872 -341980306 -123555838 -966750006 -620763633 -738769275 -409422779 -681326809 553230625 -80011780 -450770950 -619178969 968617404 295305256 -625347405 776992726 410471450 -252962760 175781017 -383807227 -379938599 -783810170 427685361 -254689244 859547690 228353652 992097529 -69433829 825197394 204671451 -72…
Output: 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 992097529 999144048 999144048 999144048 999144048 999144048 999144048 999144048 999144048 999144048 999144048 999144048 999144048 999144048 999144048 999144048 999144048 999144048 999144048 999144048 999144048 999144048 …

Constraints:

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

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