CT51156

The Winterholt Peak per Window

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

It is audit day at the snowberry thicket of Winterholt. Fletcher spreads the ledgers records across the table and picks up a sharp pencil. 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: 1113 468 -272142311 557059042 -279988020 -44495831 814124089 -612242995 -637328304 -412304756 239879609 981268052 485042411 598255574 590781881 221317098 -362843221 -419871245 -458796400 -224420475 44013357 -673232813 -829752576 454364965 -309712768 614085475 568183504 -828054124 -290508011 568617917 511386734 248428702 95841602 -981933488 679448674 680606030 -818905946 740072736 413264263 -770522455 -626557105 -333712751 -166614567 75336996 -673323152 -86470229 -97175515 -72460851 -313768749 498459982 786620437 -447017629 278981891 848268892 -680466043 -401784642 183834604 -373532540 954872270 305250512 -572905304 -387785144 579365004 324787032 564029892 655960024 -991045549 270880675 -652767689 -926744858 -552154960 68027661 -764889784 -784601234 -684830290 605960590 -172839403 219344317…
Output: 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 996970088 …

Example 2:

Input: 3398 1437 -334872778 751288926 -957037580 -472630449 707951943 -236759171 711473960 815041279 849601346 570557199 -820755592 -636413982 -811550161 180170361 -678506141 653744453 -527191572 618580626 746499913 12813749 -428254219 477710165 -898958194 251051200 -166440183 -771928127 418273931 958943397 -46188584 594991473 -913258696 359630074 -26410889 556761433 -497480448 348480245 653075255 441157312 -550419105 -372819588 -669050906 -991329739 -925443486 -42817584 -196500394 273976138 876852316 978390454 889772445 973733912 -215195127 144034473 281116394 -784276509 550389311 -487374870 495302252 729797876 -592508992 802794789 233312365 -277991239 325496872 -767024887 403306632 -674371967 196831621 190066116 551955888 396973739 183292683 159085199 -849728082 458105903 225976108 962695750 83…
Output: 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 997490860 …

Example 3:

Input: 1342 42 355785626 887762428 358821205 712970201 -618660344 229447294 -853220120 199208168 211552375 -760124253 837042653 677272857 828889361 412215567 -84310631 721837276 675413635 687844025 556023653 503862734 640788377 -834731646 -571395384 -945197532 -43534329 -423579022 -384357747 -971594627 -114278499 281546930 -169791772 530379204 -178947914 -406195605 135165794 -858456287 457062439 826239926 948732928 351138078 287180920 -64588149 -408922182 -498348684 504747880 -312981112 -163410303 -315313736 -384348405 378979105 312267668 323559760 322392010 183577983 -145015559 768891053 201146719 829392749 -399422644 -470985830 -482112573 -83984753 949971378 -549281928 193681399 -674878196 216828050 -73419769 -185289172 -186690475 -589501723 624867613 -118092875 65222507 619049772 -643963875 99…
Output: 948732928 948732928 948732928 948732928 948732928 948732928 948732928 948732928 948732928 948732928 948732928 948732928 948732928 948732928 948732928 948732928 948732928 948732928 948732928 948732928 948732928 949971378 949971378 949971378 949971378 949971378 949971378 949971378 949971378 949971378 949971378 949971378 949971378 949971378 949971378 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 996119974 995066210 995066210 995066210 …

Constraints:

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

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