CT63201

Amara's Peak per Window Ledger

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Legend says the vault under the anvil district of Hammerfall opens only for a perfect tally of signals. Amara 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: 602 602 51889585 426690482 505032693 101538265 701845372 329019675 855701265 -500164655 281443391 -874369591 788992478 -577540725 734524872 -531367186 891575693 481898533 -197877882 40551158 610863880 -705564123 99451470 607548 668676034 234042885 -84589611 955242538 -989414811 -798913851 928541468 -333567931 -850950012 287218565 930107214 387735988 -402340994 104597991 272746781 963083040 -56939607 172136207 751329745 261554796 -481563167 911650861 -504315389 -411109496 -796137013 644855931 -469290943 864411814 -814786715 -803392437 917862944 523262470 91337179 -684820285 950292690 -302200488 -535548870 419028691 -698989200 -423607959 -534263004 361620908 -259334126 -989032074 -659675668 -208585193 828358557 -581948226 350759778 70978713 -397462010 968895806 39917525 833005681 -864174393 …
Output: 990466352

Example 2:

Input: 446 410 -862865195 -196589223 -254661196 213100973 -468720374 34296014 -748637039 646907426 603566629 -166804976 818789635 -879591655 -968230153 -748864660 -842726316 -772363256 628585094 277946392 -244297834 -410106179 715534677 -747336933 158965467 -665427082 795229065 -988400991 -26022729 -487695233 -930051209 -895781990 -261688905 424404955 464771857 -844914887 -171251136 737854860 -92661342 -877954190 -985223386 -503328915 -24177397 694913155 -249963997 -739422231 -208663389 -295463819 -910414006 -287958507 143222718 984083301 632453347 -89349392 -658083357 748672832 -10906388 441387832 634302184 642325636 746426370 537933025 -138659559 208332879 51060656 732778 -986464139 -31757315 -524001348 -73765802 -736222625 -68745611 472684475 -708271497 699801766 670275710 677428498 679403721 …
Output: 984083301 984083301 984083301 984083301 984083301 984083301 984083301 984083301 984083301 984083301 984083301 984083301 984083301 984083301 984083301 984083301 984083301 984083301 984083301 984083301 984083301 984083301 984083301 984083301 984083301 986986170 986986170 986986170 986986170 986986170 986986170 986986170 986986170 986986170 986986170 986986170 986986170

Example 3:

Input: 2363 1637 816242720 18919624 807483858 -325433903 -766013670 -436446443 855179345 -503534032 862953497 -364177747 -810654428 152241787 -568065200 -470687091 952743046 -532373787 981128962 761280004 -882170003 946367663 -397132519 -255793482 -220730429 -44116868 481542420 -184235623 381965231 -66102212 914105360 902408467 -202736032 655815050 -176593006 40120425 -139013672 608794391 -798390332 937647312 -478564019 718412764 486745144 226962263 -241675354 -346633062 -168028996 710306624 -28976280 -490711462 -91991652 715384712 -422470658 -715934204 337296277 440047905 409406361 445016604 708265174 877613993 659527568 711410215 -963096607 972454954 -466500288 -910489853 -459174514 -873034777 114875926 -487996448 -87065975 393169885 -132607695 437678753 763199875 965885052 727053380 105798647 …
Output: 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 999741243 …

Constraints:

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

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