CT37573

Wynne's Opal Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

It is audit day at the acacia flats of Thornveld. Wynne spreads the ledgers records across the table and picks up a sharp pencil. 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: 541 54 158225383 -123664092 -201008643 -20111453 -38202227 893227747 -12356858 -389621978 -625556273 237408365 730949507 -281362968 343841411 -418981022 314498335 -106808923 -860695292 273950013 -608465399 716249068 -234979395 -329203642 -108529267 -761440757 404451991 7224148 178059433 -34616280 452613716 -326559791 -915831127 -188531042 155815156 -102462948 -252470127 939957004 -31259449 378334656 633851364 966670651 -858742778 -207597332 -113052598 37027047 -990600413 -407700975 -942913169 -893641345 -960637516 597982057 -922631223 -782946552 635726310 -905906042 -899196998 654345350 539813511 178690925 153896660 -856388077 981803191 -118461186 54160405 -476590696 -726731653 134963724 606810541 -789977719 -555812193 998061723 328417325 -269360768 -476775203 -668389391 708041111 -3592839…
Output: 966670651 966670651 966670651 966670651 966670651 966670651 966670651 981803191 981803191 981803191 981803191 981803191 981803191 981803191 981803191 981803191 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 998061723 980810635 980810635 980810635 980810635 980810635 980810635 980810635 980810635 980810635 980810635 …

Example 2:

Input: 1891 1125 888716861 -410174789 -893961133 -77301109 -299693290 -909682722 324047716 -31908159 947605471 95411017 438052978 -750278207 -127740514 249580255 -365328278 100478278 928173816 652490017 209042194 5375908 -256924920 192740068 360989205 564589380 873983092 -859824768 855784000 -286219551 894427240 -961438531 -721185545 -206133182 175838863 201207919 125290050 481837867 869958603 837374214 343393437 555239792 -387133738 184409021 628907744 926232718 802029050 -453387953 275111887 498643394 -301200369 766310897 122132999 912640534 367204992 246795053 536517927 209618097 -575039425 -862553335 -342415885 -805670585 -752808796 929467688 -615345714 -466847308 -350982029 -976421652 902249686 899836674 -830253179 -334390430 -350041128 26894148 634551308 749966209 351249357 -42277209 -31642…
Output: 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 999370488 …

Example 3:

Input: 459 211 -26903068 853470245 710188302 -499466053 731263661 -298783963 -113337712 -963776640 -734250573 722378313 85496476 203504498 79489417 366249895 433051378 47437496 -715977669 -852598610 497601482 -766113898 410301683 -930949356 945870918 942897619 941216655 483772601 -712155243 -321334365 -246161175 -923026176 693882589 476550963 -669931425 -615435562 -799019683 -521031773 -878407478 -96726700 -115968019 638076168 48085855 -464881110 961220453 -84129629 888411696 971713124 907392486 -652093045 393392979 -960255995 761270649 735323899 -415098982 764924201 93321838 585880464 420787412 -568321704 -66321625 196421151 258674133 -782865379 48041176 -117028012 -843923815 -675372875 503224313 -38753029 891187822 293472657 900399068 -422637283 801460094 881440526 559396752 -552748093 -5445523…
Output: 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 986366439 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Wynne's Opal Ledger - MEDIUM Coding Problem | CodeTikki