CT50419

The Peak per Window of the Shimmering ledgers

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Rosa runs the exchange at the tundra station of Whitesnow. Today the books show a list of ledgers, and the numbers must be worked out before sundown. 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: 22 18 -63406791 389594020 491550718 522192548 514234257 403610630 -669637569 -563027833 139082019 -680649907 812818532 662992185 576607308 -777092190 -625898083 80182799 -7528936 -136766078 196522557 780566007 676970642 -936638000
Output: 812818532 812818532 812818532 812818532 812818532

Example 2:

Input: 3703 2339 527039172 379465820 710639705 -241732337 486706520 285684026 83895766 -859933261 -110175193 492474012 -9097571 421411858 -793318890 544564957 435540351 138300294 -537596261 -424293082 -506460117 403086518 -604278729 -238559883 937297410 -967341820 26246904 835932631 -593731034 -774879310 310880731 416512787 758987621 380798179 -131173699 -713699910 -26996189 652562506 -610470530 -158544644 -377035722 559607283 15885426 -443145889 -222406865 -135797747 120519232 -990870542 -899063093 87044701 -748979730 -635645772 -332820811 -4330820 751732435 351449802 12135897 197228520 -483487251 241802956 283063121 333431159 71082375 -37911034 -976674805 769979579 218020713 707318385 633240609 -140673575 -316477188 -283929322 221385768 978734253 622290395 -23585112 888246741 121412213 -4853412…
Output: 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 996499843 …

Example 3:

Input: 228 114 -507214490 625245123 627218815 -935342096 -752923471 -833931317 -443518080 -480068567 947340151 140206223 381028327 861402046 -609839598 -495473803 674915238 -736133986 696837806 419217211 -653222691 819154085 -551703804 -727196260 487304570 -390083366 712833289 -384099195 -67158095 -444994853 -379338533 -348235304 -205281790 -870087588 -260280257 653500309 -957831195 -497706318 -645118863 -788366545 -939604504 -581707184 -297967128 775810961 596527531 -532394711 477859661 971042467 -613181743 -993804690 -797536041 310408997 -366151365 -170324214 -442794544 368865239 -167197575 -823733650 582021777 -779433378 641542365 803699688 661348334 -411237092 -180803614 360060089 -648913914 36374335 -217045230 -474628345 -149930471 424174425 514179284 324014191 -453940457 813517345 -94136763…
Output: 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 971042467 967248823 967248823 967248823 967248823 967248823 967248823 967248823 967248823 967248823 967248823 967248823 967248823 967248823 967248823 967248823 967248823 967248823 967248823 967248823 967248823 967248823 967248823 967248823 967248823 967248823 967248823 967248823 967248823 967248823 967248823 967248823 967248823 967248823 967248823 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Peak per Window of the Shimmering ledgers - MEDIUM Coding Problem | CodeTikki