CT45058

The Crimson signals of Felix

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Caravans arrive at the garden city of Petalbrook with crates of signals, and Felix the quartermaster must account for every last one. 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: 3715 3184 -677332272 -974268836 445267177 -600453803 -268990837 -653225326 712764468 -548130025 -95057173 376836277 235540826 -24074415 -998944060 -248536867 -946111791 -738073215 525041106 188913494 617194382 687050083 -322613913 933843601 -737326763 -932959532 30792652 -768003146 646259116 663931062 -842897635 -928539152 868660578 -321397819 -557340199 362448906 177928034 -538583088 -478651773 942085148 882927806 73213654 451198466 -906730946 -561557768 -882797139 390528819 312102613 369615605 -191003849 332105358 579814415 908542078 -791701914 -137014592 -103221085 114157054 -230279813 465072200 170974278 724127538 780977574 -792261447 -20636042 399389102 296519805 598674143 -370852286 158218924 281626141 -616128284 444013618 -337609760 -676632572 323785979 -31467240 -904025400 -8488175…
Output: 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 999542140 …

Example 2:

Input: 3817 1907 -986329559 -65713835 916737638 -203353222 675825243 -704254907 -421648940 908141666 -287796504 347720341 503967540 538800603 411633316 878012771 793116552 989426421 -785860582 -481215836 312305501 -610816071 -622589038 -807986287 -750718520 -871493717 790388027 -998000727 -52601952 -555064635 84265993 -3707866 453792453 744229855 -247981243 609953679 523740730 -189827157 779243561 -511103415 -245364934 868607322 419252717 243408120 251924519 -645699447 -925834775 -417936262 220323721 -308345140 291375150 742046810 -346738133 419152370 882070002 235894404 -276619372 279855745 709356681 -593662097 839457489 985004057 898181439 550232503 475472214 606606839 946950448 -288360712 788946977 911850410 110248558 536340177 724543454 -478630602 100460837 -883516062 -452628335 616334998 -70…
Output: 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 999373617 …

Example 3:

Input: 2733 1356 507907870 -478138436 63928032 -641737067 -709137126 -57070615 587263805 975252127 -301345780 -781423583 443382653 -858480416 163966408 424604606 239011312 233890093 408911783 602881901 6050702 -442345529 -885871842 850576075 -67919174 -651359899 -510717155 353815957 -467744348 376379585 814149673 420352357 621785280 -441305264 -46266213 542602675 -160551440 -931642981 16010590 235982928 953118821 -380057508 -930594542 990482448 -89010524 287234569 -738500775 -883647036 -744190504 -964385903 579127023 787983176 -55535208 -815624020 -648238586 643664035 674845805 -152839639 43150925 -639332614 924663186 11557740 70101451 468023514 -187624381 505533024 304940890 -559724334 520734883 833552294 -65608847 -35291342 897940227 -129216061 -785181738 -326911352 -239120749 426465698 -183070…
Output: 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 999303551 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Crimson signals of Felix - MEDIUM Coding Problem | CodeTikki