CT59361

Ysolde's Ledger of signals

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Every season at the dune sea of Caravanrest, someone must audit the season's records. This year the task falls to Ysolde, armed only with the signals register. 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: 2552 1698 124678851 -212317189 400628635 303000338 822922103 414099493 -858730734 -381506354 -363601757 611308547 996030435 -556743728 480753343 466122079 -339974779 905466554 -435726950 512217509 -77428347 801550993 357379533 -409573483 646620087 -89403466 -839525144 -573870912 -705980195 -759246205 953896440 -13864621 38709950 -883601110 951912999 -647641836 391858273 -672731689 457487662 -208145712 -533136336 -416544548 -720499165 -193254073 888485469 935166824 754397553 569710825 -367787807 249784074 722866546 -685710790 -778279183 928799195 -485080838 315901606 807066578 897227385 184182404 -155585161 -553350671 -319148141 -58856541 -379136799 534311222 953047639 366700058 842518137 159108258 222185942 608041872 -20333768 512439320 589888413 620732904 567966157 -934894035 565581083 62…
Output: 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999020674 999369604 999369604 999369604 999369604 999369604 999369604 999369604 999369604 999369604 999369604 999369604 999369604 999369604 999369604 999369604 999369604 999369604 999369604 999369604 999369604 999369604 999369604 999369604 999369604 999369604 999369604 999369604 999369604 999369604 999369604 999369604 999369604 999369604 …

Example 2:

Input: 2498 862 502350055 561302207 -56708708 -791560968 280800317 43005364 333826834 -859524233 -972748739 -912678885 504100815 -682941520 108352910 797030612 8502911 884931855 955490680 -896212841 694025797 724637527 -371246497 -755621781 -52121669 462982519 -545376897 -645336387 374590181 -393800097 196016703 -335506450 -791278394 490813898 968289212 344628601 461840611 -769572874 -160192117 -611226827 -611138076 127385622 850020797 658611056 427054872 537184762 280146131 -245253549 -233735399 962763730 -73827608 -385206849 -966052565 395241531 -598749931 -708049590 883627668 991873617 106135387 -239612941 819003461 963345690 280071023 -194496309 34742840 -747559483 275640452 103400007 -788874910 550919261 -255339153 -525890336 634462135 -249499080 618490752 -406533576 -424913743 21516970 -360…
Output: 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 999342652 …

Example 3:

Input: 14 9 -468812945 353521345 331740518 -828426957 730002828 139167290 246607473 -77373882 685849360 110626944 -354737383 -491719148 -607748622 -974693670
Output: 730002828 730002828 730002828 730002828 730002828 685849360

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Ysolde's Ledger of signals - MEDIUM Coding Problem | CodeTikki