CT38414

Emeric's Obsidian Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Emeric runs the shed at the zephyr cliffs of Galeholm. Today the books show a list of marks, 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: 2645 2018 -61773010 125825352 990432448 458990464 648771157 -208282653 -109688163 -239111088 443326833 -468656879 -511185698 -293484409 -611025575 377369420 -454451550 505046743 -104477183 897729874 565885065 -714473856 -323073643 -74919725 478976059 547802597 944231856 915533272 945251714 110664912 410430258 -488782727 -83995965 -289053171 -925892704 640255535 980526299 799013595 459133453 -988124072 857666408 -353584177 -634428254 -296195399 -959859790 -647556632 849147450 89408452 -973382742 -230271656 -923791941 -796788300 -849767257 -799831908 854368538 -476944444 -285496576 978747650 -338626324 -383737534 227893007 76621299 -722458624 486091218 683937219 -48290362 -397577669 231311311 668087218 446415048 1716770 -854863651 -572483774 -931251452 -177255124 186901918 226549606 50452414…
Output: 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997728815 997783003 997783003 997783003 …

Example 2:

Input: 496 384 -427946239 -179897749 385150922 -573121131 -795330845 -268542869 -92797155 -679922060 111407898 173756972 -471616766 911065470 -420982591 43776092 -312491087 -744200582 -893611623 855574258 773102806 358964193 -904619240 645266030 -489137507 237614499 808716387 696596780 445076799 -593215324 712657556 875558322 -319635752 44619249 90907713 -507857763 277480563 728205497 652563463 226646866 169840670 942091952 320289791 632323631 -462325139 421082969 48072006 -313726271 -750743226 -956216138 625612923 201503429 567803045 -360952791 -49187221 -239259689 243800062 798277059 569834715 -241819087 515221851 -586541312 55439038 -658964726 690034749 -279832316 -602908521 747912836 -709587413 -939549822 -943253758 451809597 155629244 877233797 520915651 67422633 -40045116 -251374196 -136619…
Output: 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 995558175 996773255 …

Example 3:

Input: 2780 1560 480337336 -313196669 -875378857 950118786 -666703659 -683536732 -86944538 -612321987 316224821 -329350079 406967736 641357038 -69756468 -934155368 467726737 -109702322 -509599558 -796533625 -234242467 -176565354 -73179820 -887958911 752385443 -427802385 555980164 335393732 -994943253 812201984 775090851 756853805 424125365 853003784 175348885 148620783 -725970977 -89736490 -310773048 -551390241 -710654560 405236134 108696136 392454784 545580540 765922085 646808687 264115266 320115714 972523730 562113177 258378545 -869112710 -925525455 910642636 -825753372 111407003 -982269771 44556775 -330299268 -360866811 192648299 965654042 -514731204 968070687 595469371 -310368016 -715908778 -159798526 479837781 -155013173 -891290917 931939451 794269785 -416815384 399433962 -17105623 736638259…
Output: 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 999521689 …

Constraints:

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

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