CT61944

The Caramel registers of Faye

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Faye the reckoner watches over the crystal caves of Luminar's stores of registers. A careful computation stands between order and chaos. 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: 1662 22 -851657555 910939355 439457142 -18779054 991965076 -58358661 -800518167 579617198 112255618 -574306692 -456257771 912872866 -700761281 -170659821 -85054889 -952149346 406890941 517641022 969715665 -972812064 -837562124 -680295272 697849499 -777668476 913632169 213413704 311284431 -543349762 739795691 -560530103 -960376141 -66601808 704390910 994292636 488332155 566698168 -968976170 -584232934 833161337 -69482662 -78074715 -464911041 -901340978 -343881406 549334823 394542739 722283444 91138206 -325980992 497240862 -444547202 -38925086 107296765 676232865 -388408912 990092667 -894966213 -799341158 200883830 -870525266 -400783785 -791288064 265730143 191417476 -701641322 773382908 -186002001 748927643 256819714 -969240694 -159279993 752267868 -822468828 -734566294 -271253240 -42155269…
Output: 991965076 991965076 991965076 991965076 991965076 969715665 969715665 969715665 969715665 969715665 969715665 969715665 994292636 994292636 994292636 994292636 994292636 994292636 994292636 994292636 994292636 994292636 994292636 994292636 994292636 994292636 994292636 994292636 994292636 994292636 994292636 994292636 994292636 994292636 990092667 990092667 990092667 990092667 990092667 990092667 990092667 990092667 990092667 990092667 990092667 990092667 990092667 990092667 990092667 990092667 990092667 990092667 990092667 990092667 990092667 990092667 773382908 773382908 773382908 773382908 773382908 773382908 947317162 947317162 947317162 947317162 947317162 947317162 947317162 947317162 947317162 947317162 947317162 947317162 947317162 947317162 947317162 947317162 947317162 947317162 …

Example 2:

Input: 3884 2461 930337074 26419837 333874325 -62768635 902314942 -272008909 700758491 673932913 83825091 -892007625 367782502 -201547341 121410428 844505557 533070174 94942667 -685663885 181341448 215276018 813698000 741566036 -530791467 181709788 101730000 -37547448 393802400 816849187 -274810782 451667963 668517816 451144522 -730220168 -141579254 464692788 -178255001 36968443 -652210456 -965271014 -580270418 -358941711 -310237191 -978830712 522252534 332026653 479591484 -909458299 561784777 874514251 636068303 -577859052 -742933603 469605693 445216244 -756067167 940769850 682097037 308156809 423300008 -193592750 -964257266 605747999 -346543055 -233732584 784010448 -938750057 -555787230 -618375241 -711494296 -756456751 -364991873 -33202609 807588695 -721130510 871756830 -975735252 -365651607 37…
Output: 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 999314854 …

Example 3:

Input: 494 250 -305755352 -531640849 -486898410 415806085 805719386 -299622145 -222904995 958944672 213623638 789197383 852977524 218190857 -94826907 -710594045 -374336133 -443758402 301929278 -556927643 541024823 -349072993 990507001 528079899 -604611792 -2797887 -758746525 108523909 -230802720 795054725 653538150 -274804748 823244288 324202172 579257168 662520128 -455633014 510536663 -204527248 -781652348 -957394808 -838344262 873956124 23809435 794809946 697479021 -80672884 -891705499 763744048 -959419885 -252678018 836483870 -48649090 -853835132 -571299039 -313208591 -366180732 171361643 -21441322 -739087062 879334436 -686741982 375039863 511726663 -847020180 397238477 -22840779 386005000 689213085 715338297 -652663482 986515437 -668666651 789102742 -456906276 230150660 645470633 668021221 31…
Output: 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 997870529 998767214 998767214 998767214 998767214 998767214 998767214 998767214 998767214 998767214 998767214 998767214 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Caramel registers of Faye - MEDIUM Coding Problem | CodeTikki