CT57781

Vani's Lunar signals

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Vani the valuer watches over the crane marshes of Stillwater's stores of signals. A careful computation stands between order and chaos. 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: 251 103 861195255 -966601313 311276165 956448273 420298365 275547715 -538447904 -382091037 -73283079 -400894859 511038222 144095170 837360090 466368619 -232865820 780530693 794905751 -296518 -659442070 -446903659 -52104387 882324568 -376198104 413877911 33340206 693343698 -827091721 533829728 773785429 590490692 -429450897 -721762878 -23551229 300621429 210751020 786362147 -404059440 788888269 -380728542 239775056 64859819 171785808 -63308449 -380550528 -721642 -401180263 -417104127 892362751 -805146819 739415425 -989777827 -479755395 -959807634 285654351 -219993083 807419842 -917664175 236104585 -842983810 655959599 823900598 -610888622 -333198248 -651417577 301051676 215283109 -667946499 -65880353 -750642376 297477617 314200274 21015873 64036167 881818850 -6699789 315494651 300278230 -64…
Output: 960795076 960795076 960795076 960795076 960795076 960795076 960795076 960795076 960795076 960795076 960795076 960795076 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 989468147 997110942 997110942 997110942 997110942 997110942 997110942 997110942 997110942 997110942 997110942 997110942 997110942 997110942 997110942 997110942 997110942 997110942 997110942 …

Example 2:

Input: 1287 869 264502677 -478952826 671691100 -926557238 -431493590 302188130 -386256485 222340708 -323119519 -660070237 -308892193 -850390140 -674662847 -70351151 -192148663 506208119 744691663 450899724 859539799 114080646 -568792235 -38762623 -49412318 -672417008 962324819 789935622 -787232502 573299622 649084616 198406865 -402079947 -710550929 -780087326 611523447 -290854837 678106589 -40818411 717674160 333848575 998735429 -407036812 49234080 121197415 -114892542 -82605993 -965959383 147481804 617353768 996777734 -953637342 -100385349 -831258854 942017806 -13305489 -558054470 -185858304 -589701680 485800607 454583530 -97989439 32941762 96098205 656633086 -519762232 -127547243 -862698089 -540584600 -743098423 -746329295 231599338 -868285231 957410228 -720370974 428268274 800550799 -920526213…
Output: 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998735429 998678723 998678723 998678723 998678723 998678723 998678723 998678723 998678723 998678723 998678723 998678723 998678723 998678723 998678723 998678723 998678723 998678723 998678723 998678723 998678723 998678723 998678723 998678723 998678723 998678723 998678723 998678723 998678723 998678723 998678723 998678723 998678723 998678723 998678723 998678723 998678723 998678723 998678723 998678723 998678723 …

Example 3:

Input: 536 500 395618028 -57337414 -410202435 786821599 -7721020 -198179904 952234743 -38107086 -112428159 494888582 -507477682 351821602 809542029 745185683 -849151601 314924409 -173624036 -16844334 198046979 -737608720 903738954 691910980 558233262 -38728931 -981826064 938452522 956709323 929203591 757871333 -522064272 -913096696 410560180 -920965186 -565663011 -484710042 -92893270 694109785 836418872 -922048552 -989095953 519177785 424521903 709347329 382683609 -610454714 -997597287 138924735 499382600 838512877 901087057 925033117 580604944 -420981507 -286271675 -134705811 -990060675 -661242595 -657025644 -165875589 774405944 798775988 -926219858 454897735 366622400 861263649 -618375818 246630445 46666383 -539244542 -516598036 531875565 381023269 759333722 568118807 -138910219 358552643 73145…
Output: 999623667 999623667 999623667 999623667 999623667 999623667 999623667 999623667 999623667 999623667 999623667 999623667 999623667 999623667 999623667 999623667 999623667 999623667 999623667 999623667 999623667 999623667 999623667 999623667 999623667 999623667 999623667 999623667 999623667 999623667 999623667 999623667 999623667 999623667 999623667 999623667 999623667

Constraints:

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

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