CT55194

Sage's Timeworn signals

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Legend says the vault under the garden city of Petalbrook opens only for a perfect tally of signals. Sage means to find out. 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: 347 185 -222650495 273490299 223052930 -82263104 540200105 -398500191 874420187 570378555 99849754 -446365814 -850518155 -979584388 -889079729 -828608335 -52746135 386527235 999161996 -247984578 -128558838 196396415 -80971312 697911272 499648832 -358059301 -621315823 -804298059 -509691595 -557171998 -464277549 714756509 -582883354 -64268698 -437200473 -721446064 942304083 700838709 797096110 -601387959 307146029 936658004 -727204408 114723373 129107366 702280599 115033582 -933863224 615402908 998498458 236255307 43167209 42512748 -119059094 -162481853 890547399 347210429 -33008558 -250184916 143135943 -678838717 -391588658 284974084 926749450 -741850334 718723460 -581306955 584062719 -54383898 695066931 977291357 526827607 -483848959 -548908276 999603312 -65398653 794155797 -870204747 9322…
Output: 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 999603312 977310577 977310577 977310577 977310577 977310577 977310577 977310577 …

Example 2:

Input: 2562 453 -368559877 717207742 806175428 934566102 48895315 -681981603 871795848 993421872 995863063 -77703374 503218599 707341508 -613953783 909695506 174767531 -470190580 -14113953 -753731985 -519972065 102918330 -562131642 100822420 -160214135 -121338141 -530561078 889809297 886850019 74855017 -180464734 757706843 9263311 -774177015 234315714 -344905101 851856089 889212459 -51679779 657323576 173833066 -7439657 649353356 -805617657 -727959044 242404205 -608300640 545232437 -224899599 -735172144 725622405 -299449840 633660431 95713953 182791717 -951421432 151966680 -650720539 -765994817 -833892289 920411890 805963686 -280033587 -997107312 -562970278 796902873 -321460026 665494068 -791540747 -312596697 667422468 844456978 -157028617 815160166 869512169 710609497 -243938930 501679669 -87813…
Output: 995863063 995863063 995863063 995863063 995863063 995863063 995863063 995863063 995863063 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 995162081 …

Example 3:

Input: 278 30 9287023 -460938424 -709787476 151024622 -139744935 564755208 -746730303 864930284 197904347 -187739738 -644752487 -700137057 -337287953 -432447808 -950521793 -395415093 -313547017 801895992 216686982 373627112 -260126993 -710746315 704624333 -812314719 571274551 -123444374 -332365906 905222274 837501225 -524855767 -599695692 -404311857 608926826 384419776 -398364044 11244303 311321309 -90344423 -322369695 959001394 741849518 -501410320 465765296 -743956119 -326195141 717968913 206467260 -72735168 494652931 394885702 428154292 -510912541 964107764 -433465021 -529944671 521039524 422843172 163066073 867941404 483373483 -462412895 221140297 118580337 -471423196 826008047 420143926 -448910449 747095577 608970314 489598743 -590795436 -741683867 17344830 300081241 694677704 580416822 -858…
Output: 905222274 905222274 905222274 905222274 905222274 905222274 905222274 905222274 905222274 905222274 959001394 959001394 959001394 959001394 959001394 959001394 959001394 959001394 959001394 959001394 959001394 959001394 959001394 964107764 964107764 964107764 964107764 964107764 964107764 964107764 964107764 964107764 964107764 964107764 964107764 964107764 964107764 964107764 964107764 964107764 964107764 964107764 964107764 964107764 964107764 964107764 964107764 964107764 964107764 964107764 964107764 964107764 964107764 867941404 967814776 967814776 967814776 967814776 967814776 967814776 967814776 967814776 967814776 967814776 967814776 967814776 967814776 967814776 967814776 967814776 967814776 967814776 986748820 986748820 986748820 986748820 986748820 986748820 986748820 986748820 …

Constraints:

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

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