CT60471

Jeweler's Violet Ledger

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Before the gates of the clockwork quarter of Gearford close for winter, Jeweler must finish the ledgers ledger - one figure at a time. 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: 3605 374 -337503569 188892691 315616760 -746507738 656363417 -5705053 -140166973 -96582905 616599649 716310996 -335406669 -357498197 393404713 857812671 514237163 519290177 653783821 772373099 -755852180 -598267720 911020836 -565629737 -531085453 -934888836 73280910 938108127 538839586 -497023607 -88019522 -199524369 -836215493 -818240657 472847126 -140238494 -553297828 -927111015 -783812779 -705823610 710721128 276011400 704115620 -773289336 866098086 -883786873 -420192090 505487835 911952492 223786345 -755030252 300447940 -680422757 432515243 162217721 319772660 607611753 154117907 -697620997 564124992 573618390 -868015282 642421506 970173813 415376986 -774467360 459877395 797210760 -361606539 -106857097 115723736 798569095 946203691 -450821229 817963270 -350162398 5575589 -874505703 499…
Output: 996510804 996510804 996510804 996510804 996510804 996510804 996510804 996510804 996510804 996510804 996510804 996510804 996510804 996510804 996510804 996510804 996510804 996510804 996510804 996510804 996510804 996510804 996510804 996510804 996510804 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 998871904 …

Example 2:

Input: 3621 418 654606826 538905307 991503578 -223932624 939879846 160616749 -27440990 14202014 412146592 -798047747 -44295119 -835335059 434214945 -58851312 -646490163 906547369 379503891 -485818532 -412380402 -294935288 -212173330 511996330 438301938 -648391000 -400479809 959099842 762355122 -946515813 -161068156 334795747 -73466890 -818658990 778914040 955724773 347392257 661901981 -959433860 753146509 537616721 -696421977 348509198 919717502 654177197 -968296415 -684156756 991987157 -212769962 70874982 39880200 -422532417 150530882 -99832308 871271950 503768522 -239974506 -398236660 306638178 573739156 -543636251 952322460 370019002 111210832 437902618 -45192458 -800816713 -848246618 -314730160 577778433 355318875 529976131 83260109 549718496 589471989 -595692120 576900247 -845806703 -1184772…
Output: 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996301406 996593671 996593671 996593671 996593671 996593671 996593671 996593671 996593671 996593671 996593671 996593671 996593671 996593671 996593671 996593671 996593671 996593671 996593671 996593671 996593671 996593671 996593671 996593671 996593671 996593671 996593671 996593671 …

Example 3:

Input: 833 536 157427566 -240351992 -918200395 124871353 242376062 631073554 57275568 -518492497 -834879509 -581733753 278592463 -923346294 935080743 -913337435 -571324854 889738581 752105586 112920061 -818612638 -40603516 989151559 -681776482 389104715 -595221962 -76835147 952719319 -242542102 -926439862 191724500 -358172412 -724773550 853951041 -521166603 316563640 -121000832 -925157808 -516153689 443982497 976617374 -826472844 -744501355 -771838328 -269903092 925450681 -912973182 65900824 -125225057 -880691409 -851425833 -390572284 745771002 -987065694 -306535615 232853663 988056374 -952410011 808366458 -854788651 -198049502 -715326637 48101285 -559520192 521659769 -999579255 -998327646 -561698991 797936987 -186123475 190496231 878770583 331698091 -716297768 554699562 363474770 541521215 -5326…
Output: 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 996440198 …

Constraints:

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

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