CT39277

Last marks of Mira

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The harbor bell rings at the archive halls of Scrollkeep; Mira weighs the day's marks manifests and starts the calculations. 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: 3034 2470 -475771029 743545248 -391766056 323730257 -558086442 277995872 -280487747 698588209 -222664809 -505022031 307322668 -117232832 970751016 727710050 992172545 829071228 849000933 -712843581 527300751 229589653 -54673187 -417264666 389797305 344950499 -921523140 -461551368 827610850 -197680752 -298469308 936236908 60511136 -457231818 998852992 261763024 828704242 -517931829 -649760622 -190267783 -702993940 484205815 491743196 -347309854 -944990784 -491661198 -761546095 -804683789 908150665 -237529270 -831675472 56530881 1215556 -91413905 -244829302 47474942 201642554 298494074 663012313 143075062 400486222 92563831 400481071 -311080570 6787210 937494535 -965967053 591271654 -113531856 60914496 -775248596 488981202 536293433 365982130 -656561337 406059044 682779002 877027379 78699591…
Output: 998852992 998852992 998852992 998852992 998852992 998852992 998852992 998852992 998852992 998852992 998852992 998852992 998852992 998852992 998852992 998852992 998852992 998852992 998852992 998852992 998852992 998852992 998852992 998852992 998852992 998852992 998852992 998852992 998852992 998852992 998852992 998852992 998852992 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 997501815 …

Example 2:

Input: 103 76 -415795847 -873565659 -276173142 -773514475 910969886 887567398 646524437 -394417113 -977151416 -702651303 458214982 -389284977 -378013992 -216618215 868099896 311281066 -36990117 -200091973 -492893873 323510864 -738468573 -779112556 145025429 509706246 -289590006 -766412767 966339904 -320047805 -102565278 728706116 343859421 -570504780 203179872 426628564 -910857022 -843150652 919725896 821320150 434680493 240418568 -224280285 -836496976 918437698 57243370 -707964120 -924804868 116063440 -892545871 -835594286 224698186 988322201 523657869 -538155239 -975751092 691480321 -691497807 -927556696 -697878809 940384647 970932570 -864249888 533725585 237347221 -549392357 -627085853 -742367615 431062860 532216287 -851829353 -676651799 -192197850 -87563120 942366849 -106535243 -312361780 -11…
Output: 988322201 988322201 988322201 988322201 988322201 988322201 988322201 988322201 988322201 988322201 988322201 988322201 988322201 988322201 988322201 988322201 988322201 988322201 988322201 988322201 988322201 988322201 988322201 988322201 988322201 988322201 988322201 988322201

Example 3:

Input: 1613 684 -531219444 435175182 508530301 510139103 818496400 523186813 -84266945 -97206917 -696926381 684202531 -204637972 -163031498 408163614 -696220067 23412335 -894870486 685084706 537419622 -993373928 -125983896 -879926446 -419231970 899793971 52140622 -750718565 -896919750 229896160 -790424134 194720238 -428272089 -837224833 206821649 926274730 -386355032 567958673 705230113 -840069195 771519860 546094122 523027653 -249314699 -765071656 -236121941 197181556 -53292249 817192191 -105294484 -241114209 238109445 -335749441 -710861381 675940456 -499893600 -208013265 -45544196 -521783141 766845161 -101540008 616046076 682270436 273519429 -314577459 795612527 467692597 -666277452 822099677 590698841 -99032193 -486282146 732878960 639838101 -926870138 -323397913 -465336287 519375010 -86137878…
Output: 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 997053080 …

Constraints:

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

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