CT40331

Yami's Ivory ledgers

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The council of the lantern reef of Glowtide pays by the answer, and Yami intends to earn it. First: the full register of ledgers. 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: 514 385 -169807547 -773262642 553250225 750966792 163734768 812608889 558975371 -738723570 -995124760 -706025683 332484421 855335732 994968518 369583969 642562794 636445492 357547418 744926746 -766452782 -891419629 -66143558 500337887 -394150866 -188615340 -919995626 -624956337 -413373442 495552412 -258922806 -752074230 619915649 46997281 -109649927 110573161 -21126311 138219731 -706650840 -567460885 -619512107 -929356907 -20109559 -773844363 -326832758 -795855854 538997415 247134482 -622045400 -624733501 676063178 -699038972 -987053241 130496849 724624040 -402080509 -438737706 990686924 -837563234 -154176339 -896133688 -859447319 131410333 -79577086 -712427263 674844664 -890899523 -384260432 356183018 -282975135 -204322465 943014856 813256839 -9539537 -674700046 443365738 250848432 -36204…
Output: 994968518 994968518 994968518 994968518 994968518 994968518 994968518 994968518 994968518 994968518 994968518 994968518 994968518 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 994665857 …

Example 2:

Input: 3424 476 703303557 -927759534 -386261334 451141685 999304992 -92225090 145417049 -116731960 -737867121 -121628985 -961697927 225029021 597579733 -886710404 888857532 280284349 65580453 187645594 538082928 -538787090 86125161 -711821267 446886936 -868369330 -547167599 -385825043 619200986 -157544802 255814823 839871404 398514360 467687986 -186722305 -332323429 -759656081 209586071 670581056 -583622012 114103144 -657625620 -537188711 663391387 -519266959 -600013866 -309101734 590011508 635086997 453660394 -186957718 -23203456 -413075611 -449259097 949506885 239673439 417981531 526953495 175169731 -989938964 -542187493 -784876859 -392286192 633190984 127046100 -130935137 82032176 309023326 185640078 690697012 -274127863 -28284725 -917743710 -888381298 -769533259 372095956 -805340891 146732343…
Output: 999304992 999304992 999304992 999304992 999304992 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 997317054 …

Example 3:

Input: 268 259 -273158901 116113976 654843744 -322695830 633361688 -399616236 733004014 553587207 716045301 -368117136 -312415579 293322394 974805357 -767968920 313067833 345688970 -331039638 -221847097 938657765 -325684035 -364844509 563627385 215954350 -774129695 -642303478 466524478 750276130 197315567 -171671847 61036681 253695267 -109886313 -308991912 -842018651 738717486 429633232 499600436 -180951484 -701678656 946749403 -695762005 757465130 133110281 40607054 -188379810 458946876 221278319 292642337 -982692440 496135065 -762277 -413576930 -333057196 -168608047 -201102986 841414219 899756483 83856178 -189224291 835092027 -15943276 829738506 797898796 -268008178 -335171380 307840585 491555035 -860614726 -306320258 108994968 -634630979 998062634 342848895 671302114 -290729586 -557855672 -776…
Output: 998062634 998062634 998062634 998062634 998062634 998062634 998062634 998062634 998062634 998062634

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Yami's Ivory ledgers - MEDIUM Coding Problem | CodeTikki