CT62591

Navigator Counts the registers

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Caravans arrive at the observatory of Starfall with crates of registers, and Navigator the chronicler must account for every last one. 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: 1116 1015 273350594 -311535482 -977428007 -40145694 -818705202 -546982950 -464685406 -343239204 432429390 114049443 811736770 -860732344 -879826287 -22775478 -443734771 -994615426 147007363 -27501720 -747465906 828933393 752616456 -404158610 875501133 -685553032 -877247541 411466728 526528286 691969297 629311774 136190233 660109331 500060849 597011126 582571754 619263778 647244812 418260921 -349695926 666423518 348219552 150401854 984743408 -764246450 575612233 781313963 190786321 -407407325 -390965809 669386264 -215796496 -397020740 30866764 173371799 -878871790 -560757814 -375998375 554154189 -133053010 -668956877 154178880 -753455388 -343212266 -378150321 -354958577 -367774444 33323610 201533445 733240115 343529699 -425143270 195696496 835703060 16312378 -346264779 409113701 513025231 7…
Output: 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 997302977 999175638 999175638 999175638 999175638 999175638 999175638 999175638 999175638 999175638 999175638 999175638 999175638 999175638 999175638 999175638 999175638 999175638 999175638 999175638 999175638 999175638 999175638 999175638 999175638 999175638 999175638 999175638 …

Example 2:

Input: 2586 636 67560478 -852248271 -542720930 470459503 -615181450 98856474 -466073922 -481416913 -264429646 -139687664 -694948220 -775325382 435956057 -446988929 -131418809 -261082133 -970740828 237990158 -691944515 -847311921 234390660 -275719741 -757150856 654886273 701801170 -452827772 -736115455 -14526183 112797872 257167402 -724400558 -424706102 769042787 347394928 -707200723 468114735 -885866707 344734156 -368526273 -519101867 -895391738 -878277623 77628 -526238778 373710723 -318409441 -644308884 -436171200 -240071805 -44798916 -757194568 -471516321 -400352374 752783906 -624047648 826082600 -512302844 124024417 -323935653 -51695642 632023407 -530442243 656407066 771888835 -528136052 -484810606 -848586349 417226650 488534596 -505286335 -888024975 833464533 -993826331 -792287079 449827206 -…
Output: 994110125 994110125 994110125 994110125 994110125 994110125 994110125 994110125 994110125 994110125 994110125 994110125 994110125 994110125 994110125 994110125 994110125 994110125 994110125 994110125 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 994945124 …

Example 3:

Input: 2158 596 449399322 -239534739 69816631 -795363425 -330019940 593433093 -913782731 316981739 -83879463 -721931388 216532784 -41568322 -618824159 533518468 -837837368 926755332 -584190641 -368599742 919781532 780012263 661987522 -882666188 -864259242 -717524673 929682595 591701038 -453834535 -131340588 -756648270 366526287 222521295 -165066895 695291798 450784380 566945992 697913240 522902373 -552732526 -493130724 198338917 296719796 448173704 891096211 -599336517 224248047 -925926326 -276367909 46760924 -564692866 -275237601 -32180400 -671965381 -440422554 872560539 687590083 -581755564 -884761580 153439535 -981944777 -702142021 -832708292 -671580678 657196096 -261899068 -441460283 -302575576 15130977 314650526 -157422440 696737646 829740033 -37784463 491496886 530782591 33062986 710915475 …
Output: 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 993367596 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Navigator Counts the registers - MEDIUM Coding Problem | CodeTikki