CT47340

Eklavya's signals Reckoning

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Legend says the vault under the gull cliffs of Screech Point opens only for a perfect tally of signals. Eklavya means to find out. 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: 3832 2853 275751372 -628887509 -204610546 -351223666 -273119240 821386789 41281315 611662480 -779241355 -971160402 598931719 -590850350 621519124 232670712 120450257 -723620877 162136595 888955717 -628533339 -435229047 -445523560 582598707 -112435851 526389998 -362225770 707501272 -605026685 226732835 880332758 793334496 -996685191 872911162 434375191 -125116203 -419107421 -746097752 -700831494 -502264973 782347165 886321353 -719240476 -558087591 -3965403 610207064 138106308 -613886396 930078103 646574475 457101049 -879991264 474535010 393651075 -140241214 -883222781 982494483 -550356013 143474341 72865958 -452988573 -379990116 -49152376 -820164505 -784662135 -25851367 21909032 130494097 -509601377 -452326308 -465355053 -42703718 -849609541 -267270654 -99898276 674023980 470041758 -5145679…
Output: 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 999406725 …

Example 2:

Input: 1084 880 211521882 128125817 -270423503 -254580120 -605199929 2712131 -175846757 440758050 -948769103 -933404629 679940002 808891835 436383167 422263550 -131883013 781572505 -389246486 -68290276 -257360614 -637850074 -600860268 281377871 -973465896 -530376544 552014830 264820780 789303452 794995177 180220481 -985422705 218324778 -505753699 470830783 244590389 290117760 463683289 706793152 -555001806 -991097846 -46844696 138186365 -644668960 -578270953 -203951481 -872305811 -86322526 936199438 73752652 414853481 916185738 617085084 -133494240 -245599434 98745869 738324363 164770914 546340254 -259509352 256854629 -447627131 588239781 648063062 100031264 758478346 331269180 134000574 -417052218 518520483 -509996088 425972222 -29059554 71381217 80652555 -812172252 -691051008 815903446 52482973…
Output: 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 997744307 …

Example 3:

Input: 3304 3092 -391411348 502498658 488378969 -953916864 588789195 79316681 -465312310 -888831490 90708391 -518215579 -254147900 359774733 827359545 -36542741 -720823298 -338998956 -593771913 439199211 689721480 -803181440 -98798526 -739929987 110453100 -197791869 -32153080 -875551873 -543864805 -779519271 315316020 191963850 -616011887 619761287 -938038375 134009580 26810508 -822910633 -300659740 -89774052 -19577256 408994659 -334268609 -581595771 -485835749 241705190 577924080 -162743626 -269084508 -782737003 -399680639 -411447308 -446729667 -12045002 -829436096 831530325 -245430774 649378815 -482829685 656598337 60864556 -728666203 -413852611 -179360046 -905936310 123427752 -924668103 704383907 -695662538 -329313962 99710179 -542721340 235823274 -724900660 341847979 -302257517 -872059817 -75…
Output: 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 999511288 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Eklavya's signals Reckoning - MEDIUM Coding Problem | CodeTikki