CT43384

Last registers of Axel

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Caravans arrive at the mulberry rows of Silkmead with crates of registers, and Axel the store warden 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: 1407 863 722342432 890382030 -942751627 791408369 -518827152 -236635787 -478010899 -424175634 650865642 393685038 -722435046 -447900336 -811910858 283453166 -252728812 181308755 749055237 944776535 -790127127 146419927 538899200 896776709 -208523455 -447740019 24496974 391856496 292342815 -107920172 -115562033 -553352725 803103298 -179850115 -342174261 -951940496 199041602 510958935 -29875767 -515358404 336061295 877749140 -492553986 421305104 -844401846 448462777 -32829945 -225737333 -328993879 47670074 613926719 -506630848 349943278 973113080 804937412 641520247 9463816 248518666 404746567 -28712835 641800285 -479404800 969068795 -571149167 -944306305 879110717 853764800 -561955426 421610465 -917132253 -506128270 -437038352 705350798 886406796 -532374969 -185635991 -236940439 277059633 9…
Output: 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 999815303 …

Example 2:

Input: 1034 79 -21483898 -240112372 419303183 206543973 -264442711 367142260 716354240 316475988 -939756052 -762957265 -79490892 890146365 -872869676 889073043 367904354 873950953 489528267 532199294 719969899 560557101 -64119606 -191950524 514213106 -542062295 -497140516 587110826 526605843 -684938287 553621470 -22495214 246597730 306519719 794430259 -389963002 386822744 482017618 549460757 578490554 -393562745 -863667071 224364700 -381006660 146828519 -355294836 490920713 -443586913 499682597 936315393 -617883066 -847277868 -545078800 -73559543 395988005 -278866682 451619193 -992795201 874372686 563755687 88049703 -971707637 789915228 -346337553 -768670397 -386035588 -681986357 -329213432 -407862319 -542730985 -259854788 983417988 594936889 -267735427 -717289305 702027605 -656721888 277757051 -…
Output: 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 983417988 970525000 970525000 970525000 970525000 984565842 984565842 984565842 984565842 984565842 984565842 …

Example 3:

Input: 2399 490 83535401 418275270 -174110542 -626360321 627314441 -729403855 -935651361 -549191613 -179074845 176017137 -10822406 714243482 -855302260 -439323177 -96359775 57089233 21621800 -49832658 322838954 658888219 473098499 -908381752 44118426 713023788 819644529 -71129153 -286032413 458070031 -660589683 -359773179 -854883811 -320675639 836389214 333010554 997465820 675003027 895831701 -27060188 -813761875 -140825407 -681208902 234129370 712595402 -713642609 266762073 891594584 467062763 124677021 -804393250 915525574 -725710475 458007566 -159119380 846571813 -962611301 -457680797 223793809 -362823786 -98368885 809548705 476767147 -722886312 951873082 -652372417 576050582 -711823706 856150359 -900946814 -921348231 -846340401 705585360 -959620141 733800708 -134770229 -920676942 -496803397 -…
Output: 997465820 997465820 997465820 997465820 997465820 997465820 997465820 997465820 997465820 997465820 997465820 997465820 997465820 997465820 997465820 997465820 997465820 997465820 997465820 997465820 997465820 997465820 997465820 997465820 997465820 997465820 997465820 997465820 997465820 997465820 997465820 997465820 997465820 997465820 997465820 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 980254283 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Last registers of Axel - MEDIUM Coding Problem | CodeTikki