CT58297

Milo's beacons Peak per Window

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Deep in the shale slopes of Greystone, Milo studies rows of beacons entries. One clean number will settle the guild's oldest argument. 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: 2477 1751 -396505643 -291723751 204855250 587612047 355656962 922771945 419834504 153409062 526954524 924452778 -214300871 169598553 -597858750 376781244 -274740877 -134974144 -608921371 681479712 -892158922 443749802 104118818 612922723 553719501 297300128 229691471 -165000527 -659870705 -745323411 288216280 921199853 432261444 -313561012 -277910556 562462695 126911797 131513879 -814463281 877080582 107672082 590496900 692772372 443873092 378320125 386682963 -119287318 630258251 560069863 -933962916 -513095666 151015285 -336918715 609410224 490084410 279012565 270724492 45155821 -652323634 -857111876 -879530852 -437296635 -389244462 -269603218 -515162503 123780306 -384638669 506201495 854435420 -470428991 -345686057 -798172589 -261434445 -572458466 964591834 283602334 -866207630 -30478898…
Output: 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 999151110 …

Example 2:

Input: 509 444 -183386954 658068492 -453567554 935659890 784672786 -205555074 -692886786 91079311 257847051 582071549 492867257 986964033 943448088 193851151 208058030 140581016 -455382563 935655044 -966257080 -734287224 -698117130 -687935314 -342100428 707319334 -464648037 -912528247 142511034 -992922274 447789656 -719077635 -17694101 -36216653 891616883 -479021745 344423033 925521280 415956959 -151315584 -250825402 -80586974 714492565 813589288 -251735458 -773100341 931642508 615654534 -323915065 195012496 922020937 -831569483 -664989338 -391325664 25367869 838535842 733518425 109654399 -694719248 943276 -202325495 658536738 539160979 -779281310 409685513 182659455 -424553867 -750679546 -835026457 -920376989 462981121 379585801 847561131 214117705 -965060601 -382196559 91547465 634281762 957793…
Output: 993153339 993153339 993153339 993153339 993153339 993153339 993153339 993153339 993153339 993153339 993153339 993153339 993153339 993153339 993153339 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250 999664250

Example 3:

Input: 3393 2571 -730383185 52528582 -752681432 597778250 69955031 19884945 180743188 -574664636 -98901769 -621632981 -201543373 557849743 832003451 -513666686 -180029354 -843269152 -814486156 813720413 -708485254 -159045575 -347461154 665226840 30149660 817466010 -75365930 429285256 847728348 115108860 -380063965 101355939 -701805044 957643394 -866454087 950517821 160027854 -232379296 387029538 -441280459 302147611 -209920708 665804992 -235522587 278028524 127125831 768660375 345473872 807184699 612042493 316142999 -85530995 -576146512 -458714775 976983060 -516599651 546134628 -941602053 -358822216 613141219 264402380 -204820059 624134970 351428384 -246100126 -84725289 -521713852 790942029 415035867 761908060 938898709 506990734 -393872733 -423081936 872284127 796560330 -912018561 273569311 9554…
Output: 998383826 998383826 998383826 998383826 998383826 998383826 998383826 998383826 998383826 998383826 998383826 998383826 998383826 998383826 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 998427060 …

Constraints:

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

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