CT37667

Ravi's registers Peak per Window

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Morning light hits the herring shoals of Silverfin as Ravi unrolls the day's manifest of registers. The tally will decide the next shipment. 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: 2454 877 -786238713 719186886 -453403027 787710094 638309366 730382273 794729619 -753139136 -799469085 417247696 -990913190 335801821 -784316513 -509961779 -611562050 -35528555 706210304 -41087663 -391494191 129065058 -178860214 692545413 854221259 542720027 -786467683 633732411 -849548827 243406220 554807269 388722127 -367558278 -713555738 690712779 -58606258 -432508323 147009684 903026635 -399379327 599543362 510853952 -265140861 -261146018 -8458678 -376379399 735503519 -198298489 537171825 -220823725 209605842 150918189 -771661466 962955809 329492244 -426896611 -372078611 -461096504 -39926847 -938097699 -264339393 585687690 521732839 -263971111 -6816637 236813550 701379985 -418387502 -242903643 782223348 322797866 963213140 -429227762 529807408 496112124 -400376571 479792212 751719979 9…
Output: 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 999804305 …

Example 2:

Input: 2383 417 -393311837 113862714 942566235 836367759 409587732 -955309846 -298670895 344738913 -867088292 939495940 -281611811 -58524034 71615128 84826207 370975330 370310464 -479077311 -652914477 -477266917 -22524667 -799530539 -442308886 -215764368 83436824 465788142 536265205 -342722116 -973101158 -507961 -661371798 159830478 174268754 250512354 368596446 512177322 -517760805 -338366140 261510293 930224621 334186140 209977304 324266856 -83802671 139940575 280315508 586367934 -645452282 380828280 -876213436 -496575567 893448761 -806084548 -829146883 -793409733 815012094 345101093 -646676098 888741838 -208149935 -75713745 973477008 -711812264 394973034 908403330 162395680 401728527 -879596539 -864350328 344895652 -435783931 376208335 851592753 518249373 -799821692 101264695 -515668469 616823…
Output: 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 986618970 …

Example 3:

Input: 549 213 909903942 764060272 -649921814 -734313369 450792482 -823265970 -903415102 159616923 -301191049 580939440 -477582323 240889547 -110976280 -233828433 -533302749 562710562 166636328 -919872929 -185252005 65604261 596350029 -892917531 387741234 793984865 916060217 -480465035 -972062048 150814152 722199820 -950535946 -41673327 -385330230 171056319 655414873 214734959 -99701685 458819350 -51988849 939538332 116594140 706235173 557797616 -225155550 607115153 -239005135 -835123656 909021640 470562420 -230576842 -445532222 -431298585 -356771577 37279838 739833957 952252026 549858706 280693401 922940454 -613377094 -747152044 -273041626 -841099639 -247348902 -318685889 892735379 431444044 492871507 575635240 -677785659 -548128849 -657419339 -88203360 -447486532 -891569967 -646985048 883272052…
Output: 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 979142723 …

Constraints:

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

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