CT36711

The Peak per Window of Bramblecourt

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The council of the thorn maze of Bramblecourt pays by the answer, and Fletcher intends to earn it. First: the full register of marks. 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: 2934 1164 590478413 -244212473 -469685362 444169388 838995971 -851512841 -80264317 547667821 872356679 -826298480 355729795 73394357 403742014 849144095 199730527 -574633582 966574031 889921738 855487390 800542815 -693134877 -294030772 987403029 -563869966 -845354259 -796357838 784420713 -236689111 584727545 -813204137 431460202 -86307159 -726943272 -614722663 -75836592 -354433348 57577629 -400667373 -219757156 -896125990 -869694252 -382237006 -176174276 250995071 954552724 656560440 -198305461 -459711688 -556575248 -12607456 -83592420 219654705 -33475904 362236393 -378655306 309473120 438048657 307637009 -98891027 -874758360 -300772180 962398447 -990155317 135675808 294168516 787399156 -734507236 -831517842 -412801270 134586899 -927825342 -112494782 -45267902 905941030 485469096 -93231042…
Output: 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 999595706 …

Example 2:

Input: 1990 1672 -785524158 -295647603 -157463776 376563598 654248406 -725114116 -124982513 947856124 -107420707 755577786 -316104295 642587315 -88746282 -136538813 978097842 -23667252 -638327555 653099052 -536527301 -517603371 -467105815 -870302035 -785782373 496703449 -807706083 863468525 59230403 -749380236 -137745063 -419905339 839605485 -545850425 650692471 825536559 -532027375 -407198302 -413126857 899795728 -81081565 957067103 562785191 462271613 717662955 539577609 108687229 688153721 -753745639 635828804 304727863 -630222098 -869115852 9862989 -305511288 -388004540 825877416 -257691701 912149812 569237929 992159847 -173465779 -79842918 -880285439 26934629 323095471 243459312 388832681 -150663875 999778739 -82266784 -615398793 196611202 624493450 -726474417 -928064281 744986874 57956373 -…
Output: 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 999778739 998484143 998484143 998484143 998484143 998484143 998484143 998484143 998484143 998484143 998484143 998484143 998484143 …

Example 3:

Input: 2416 2056 346646314 -144398751 -526848112 818474914 518990118 -460518297 929892160 236364887 -283476670 45740294 36273350 574470794 -213987233 339644724 -564209381 -294537955 -216702540 681103800 162801078 363695489 320489263 340655660 875157625 -127420970 -355487020 930499515 -580953579 842267473 61242682 228898756 -177208159 -455986650 590084105 -436025027 -206709015 -859714772 698107477 -233818379 275145908 766058686 -606978199 -5219985 -197416174 159756427 809867581 774837116 -908554195 -110241456 23899742 -977571376 404386725 13941347 -139316244 -493439080 -215583164 -592203411 -96452476 -150676410 434136409 -482539614 -276076996 684277037 -658485049 804700653 -356351721 -745800607 76419467 307321038 -61957159 702740447 -159689814 203355840 -845763272 -535903211 499548054 -535404903 -…
Output: 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 999039539 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Peak per Window of Bramblecourt - MEDIUM Coding Problem | CodeTikki