CT57171

Quinn's Crystal marks

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Every season at the fen lights of Will-o-Wisp, someone must publish the quarterly findings. This year the task falls to Quinn, armed only with the marks 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: 939 485 666357575 -327211066 423715490 981566769 863053598 -457575328 759107451 -556075523 -801808130 167222317 463171470 52655976 773647246 566060895 325490711 -107938354 -355200554 185531409 -263034219 -568159644 -604913230 42718804 954493969 717591529 -246046717 936822847 -12314054 527577321 -131446007 92081135 625233743 634016851 945344226 488459928 124264734 -788481382 -689973158 217269951 -185617679 184702512 -562948672 551836562 -627842489 226111119 107770737 705276218 821677099 78888038 -3781976 763273700 -809771241 816105967 810367288 -773374414 111793408 46527295 917696079 108188621 766776634 662434951 -948824730 -302804029 991622867 90829110 877930084 176187760 -772795224 -474799970 633360298 -33943717 141396928 716019067 -533625329 893886390 -544428052 -781664904 435130691 -196…
Output: 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 995035630 …

Example 2:

Input: 2582 1365 649497138 -116390342 644093015 -821400253 -194262749 385602927 -103713059 423330231 631992950 -644234404 688419985 712729753 452572581 578147704 -824308719 508515130 481811899 -806230243 -2131725 -200026046 -264191015 893963877 734033735 364146726 911229026 607712686 605774926 926332265 -203691098 927114377 -560697605 -94102204 612902002 868685758 -965340457 672232776 860703977 -432745485 -968479015 704271494 416407264 -685665531 797414577 -53508780 480597806 -454501332 -505449062 635513163 980342342 429467921 532217080 -329293484 955565342 -803011611 112195254 487725019 74041856 894129141 -459269509 584157802 148829341 -549402505 968469343 -524711431 488011512 510764394 451337912 -739315089 311696843 -12043763 -141302401 122618132 -854285962 -396954327 -597942990 -153359544 2427…
Output: 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 999534857 …

Example 3:

Input: 2341 1875 790434108 791937439 -858838554 792362164 -438010501 647445104 960672097 89193815 610877579 198959126 -784473909 971358707 183112302 596229292 210647160 208460052 456822937 228127866 102563971 226765185 -901174618 -756139803 932985156 395485264 -788695655 253016902 -883368617 -970081958 -754856394 614280041 465556570 -319965581 120743499 -763553684 -413363329 -282287616 639361095 -376767325 526618629 460253685 690212640 -671899430 -644747267 -435735759 -663237375 473761147 -969620943 -220014177 158332438 640969560 -211182711 -299990676 -549967418 165846833 397627867 -373252069 325846607 -147359948 -19573858 -272894815 970756971 -305394199 -584080662 659859993 -169570721 -121384084 492324489 -887300024 -575717564 427398499 931064150 -574469236 -685556701 440961780 905585527 -327288…
Output: 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 999446618 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Quinn's Crystal marks - MEDIUM Coding Problem | CodeTikki