CT58634

Yuri's Peak per Window Ledger

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Every season at the cliffside roost of Stormrest, someone must compute the guild dues owed. This year the task falls to Yuri, armed only with the ledgers register. 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: 1775 609 363980381 -488665636 792953685 924998761 -960832239 420141820 801086477 -987164696 -696045969 -950363552 513073945 89151661 -845342706 342016680 -58103949 54898340 -263212452 151822303 547150694 -57966419 -966531097 46128070 300001770 209355203 24071064 925330433 385720466 -527241128 212629047 -135451545 153361687 -587274024 393571630 -523541772 -865410599 -619376958 949169265 -414219793 -901358500 -152461190 600022490 137565387 -173050363 -263330572 -237130672 773652706 955672589 836656674 -379507073 -335536469 -125438959 -713380537 434952296 -536309475 582650491 619951196 -268632934 616271933 -149533047 -658045678 382799582 176115470 587715198 -353350475 173243406 -658776781 988818518 -672430519 -841814637 752250939 -251058879 -9348942 179361758 653275428 -839901466 389125479 89…
Output: 999171771 999171771 999171771 999171771 999171771 999171771 999171771 999171771 999171771 999171771 999171771 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 999649537 …

Example 2:

Input: 1517 679 -993841474 -491896224 790044306 786424836 -547762138 -203605769 -540003347 -459992022 987182953 318432662 324180882 25729558 -725769648 -811478015 -352773565 -685317878 448339913 689796454 -102862052 566793943 421065303 -637585232 -174903046 968422830 -489329299 -930244486 -955680681 920113009 514751499 -597223427 -430731681 952899895 -917857940 192700382 697839730 201844280 -544079850 296260609 -477133032 373092057 46889184 -77844511 -30648606 292862274 638825002 -377188878 -346863988 -688686155 -544314828 645388937 -538746739 -212918443 -265160294 -524104243 79949742 -973969633 -685629957 -267833604 942570117 841201068 762950963 363708939 697821742 -810044628 923258125 -730120845 553219136 928067276 -37308348 646926776 755050351 320189328 -114721711 448194891 632580377 -83459992…
Output: 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 997656912 …

Example 3:

Input: 186 32 -999214285 930300806 160116754 805589236 879874043 -543323072 317246384 -899329318 643543100 -992973144 176808186 546260771 528661175 -547965528 -50295181 619966370 -276072214 -114065889 -578629189 619431357 304020047 89863344 76214751 -863602030 857905515 -107257213 -555918019 -953142763 -286594887 -409123689 -642064551 -727544665 553171605 -851599710 725122211 613378582 -41838780 794533046 342604266 -754275704 922151725 -315509726 255622126 -141012578 -429682975 -778036899 127323446 -85607700 -550533887 -579539415 946178292 601573950 -974599258 -610571683 -743573372 -966781281 -347552462 -395985881 -703215980 474189507 240882917 504771760 -942495988 -529564660 624250029 -111288125 -988991131 191837123 -745891908 123017717 -295196898 -37987718 -620351879 -471234313 -718489735 -1629…
Output: 930300806 930300806 879874043 879874043 879874043 857905515 857905515 857905515 857905515 922151725 922151725 922151725 922151725 922151725 922151725 922151725 922151725 922151725 922151725 946178292 946178292 946178292 946178292 946178292 946178292 946178292 946178292 946178292 946178292 946178292 946178292 946178292 946178292 946178292 946178292 946178292 946178292 946178292 946178292 946178292 946178292 946178292 946178292 946178292 946178292 946178292 946178292 946178292 946178292 946178292 946178292 930413739 930413739 930413739 930413739 930413739 930413739 930413739 930413739 930413739 930413739 930413739 930413739 931293963 931293963 931293963 931293963 958888999 992149922 992149922 992149922 992149922 992149922 992149922 992149922 992149922 992149922 992149922 992149922 992149922 …

Constraints:

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

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