CT38208

The Gilded beacons of Freya

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Freya runs the counting house at the eel marshes of Slitherwick. Today the books show a list of beacons, and the numbers must be worked out before sundown. 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: 1721 738 -494289530 -119696080 999327569 -682624489 -204192917 -586159606 238421488 -773032334 -851099111 -480883369 -896106724 5693111 -954379091 -510540874 821518329 346422336 -367873790 149210748 -241385201 -806811234 757149408 -136192128 875785577 266343252 -635977728 -439493389 -947449200 886000327 -261179863 -74587582 -2360500 -819841258 -909786809 878639766 -30498581 616125579 551230100 -853499346 809406828 -807754270 457675370 443233856 -272319243 449505778 -540706403 627441230 -696317090 482236261 584435539 612622925 351795436 -662637258 500051612 -721831377 -368640777 -467296512 -75858029 -806750887 -591126730 223001632 -654279766 89196577 205085177 -274443916 532349432 -9740675 729158488 687569022 -370209516 -191686417 -697623573 -135564371 122773685 -856356297 -443086033 888087…
Output: 999327569 999327569 999327569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 996436569 …

Example 2:

Input: 1319 1235 -475033843 435851456 20763737 10959525 -239238120 867212757 -811589442 -862182922 871641547 575810357 91038093 35774993 865862626 747323716 -318040024 -770277690 902313713 680180797 -297641112 -453307556 873985049 -200306752 512266033 -628193899 189020158 6397093 -354742734 -446094316 59112074 307564625 -24847270 705972256 771557796 -507772230 559421900 119532491 941477153 -385741944 -76266706 -146129501 -489976204 917562563 -429866517 202830606 -88377091 -494993341 957613171 732206461 445835151 -607419507 -895372026 110172189 -100539603 328642590 -284926601 232328584 669064443 129177327 80737621 263297318 460406604 48298050 -697123930 162346546 -513885334 -536077290 877302495 893556780 -57265422 -202070547 629930667 -658476694 -816560128 -267091020 150725957 -598925736 -39620642…
Output: 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 999774345 …

Example 3:

Input: 3667 358 -341117196 -582533382 387544604 22498521 735659940 78729770 -272231924 180383058 -910162887 -593335721 -97832818 -353523181 912100218 -556353138 756683847 32976332 296626009 -457145612 553067971 519791847 -212137265 -997237029 917297279 972236522 -408781568 -944585199 33967844 869474553 -535186574 -795912075 -921999889 -84543615 138284069 562564806 -595683513 -400838213 -844937012 333097013 -678829196 86098094 105209568 -407968513 647749871 511242591 22734907 -995621641 159972315 -5086836 933431936 756085388 979740770 -54624519 -134521477 430660711 140796580 -661382057 757668064 476844821 -261831868 -894025272 -512989445 -770557505 589340367 -977292439 256387955 705537288 82444376 -825717390 570465795 200900571 815906156 -722006739 307354766 -359748012 824274168 566678845 66469336…
Output: 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 990073341 …

Constraints:

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

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