CT53919

Ruby marks Peak per Window

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

At the trading post of Goldmeadow, Vigo records each marks in a worn leather ledger. The guild wants answers, not guesses. 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: 2698 2040 790393000 804938213 236212271 -33448833 916733556 -994814931 290327525 665970343 -609825815 -273545411 857585198 -703133681 248583785 724169286 -605413550 -421840489 -468295402 -601530894 -720007613 -980302730 -916187026 -438663624 -609590163 -956402445 764045882 103431008 -775561229 369970521 131837993 -668409871 -554666581 -227136317 -596471291 75142173 -473353960 2253504 -81862494 861179157 -4406709 384205645 886509313 130206791 -442282598 667115098 -415041668 -766235000 850734261 18566428 -898694703 353980125 -317411274 190787831 -579422450 511213173 709793176 381616934 -299707631 976110997 -442619854 -357494684 453790083 66066139 -137107188 -17563414 -186959764 -358601348 -150474374 491608530 403929119 407419995 -325878022 -347122748 809248752 684974550 987859081 770790587 8…
Output: 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 999697211 …

Example 2:

Input: 2572 276 494353887 -897673917 272326317 -750920363 652047360 638249806 -752540601 -478293860 707328977 831039430 152144324 -463227509 905938885 -469883 262097299 358895052 -673533945 -832391644 689561755 -272785726 999315838 674209953 -906730741 -349952696 315293299 -913126910 502066482 606096916 -708306435 -187542130 -876530569 -58889939 951336798 247730202 -236650333 -845747506 179247095 421556650 -724408904 742097322 747958306 -98267934 77947239 -847845683 212871135 753844259 -43344527 -256071383 -845291728 -79831231 -313001439 971449120 249339849 974484917 -515172680 43097330 940769776 744973546 -33837879 333879581 169464322 -336851431 -992020795 -591395665 485851389 -440303016 -474113819 895131629 -150176319 -887048891 383213590 -16566798 391148027 304416585 78261032 -678178017 -33342…
Output: 999315838 999315838 999315838 999315838 999315838 999315838 999315838 999315838 999315838 999315838 999315838 999315838 999315838 999315838 999315838 999315838 999315838 999315838 999315838 999315838 999315838 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 990690817 …

Example 3:

Input: 1947 1515 241189616 -592840363 182736740 420570136 483534554 816827212 802078091 -651821554 814182513 278965911 799484445 -420477117 927082762 -890330197 502505638 -158743048 -665704311 566576965 -73729745 520072470 597315508 -576449952 292625965 199254550 -135973921 -447165500 384855966 621391427 173849819 580151783 740292218 -391182272 56477284 -912909809 -791849839 580983112 674449714 -171057520 -226455370 515868322 -779958257 -434046213 405827742 77216832 -228115131 -152420237 882785211 929304066 -45610027 507543866 442976247 360463771 849587944 111020669 -779234519 895659154 639767736 -566210200 -78349211 653004561 -615087914 483112057 -74145357 -63789747 377078525 -449196447 838993996 481692135 -137225481 -562481475 182246962 -83182443 -8610672 -315949661 677617896 997853988 37605444…
Output: 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997853988 997312332 997312332 997312332 997312332 …

Constraints:

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

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