CT55335

The Woven beacons of Ulric

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Ulric inherited the tannery at the fen lights of Will-o-Wisp along with its curious bookkeeping system for beacons. Time to make sense of it. 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: 1186 272 447015760 -984159937 569788870 304625642 -483947833 -775757859 731717785 655692450 373474189 -444254746 -440973137 -426720157 863213449 659403336 -937016247 -636571656 -43420314 847710182 -683019510 370145286 -24981579 -493703628 -743809776 894776195 -931859689 -503786467 -743267831 -443678741 -118791258 -184350903 564744381 651327508 -323501266 565389976 -716695970 685384721 459510055 -469751656 93406303 -829923578 255294507 327070259 -198740497 340825691 -753271424 679909123 432238394 353561762 967428136 30077053 675544739 615173589 129445990 -302624506 774303372 -393234649 -892434972 -320133391 71321337 543688777 606960312 -189823930 315729777 699981205 -284199355 722928260 -481507027 490182497 594624173 -882704251 -44010252 -991692700 914397923 43969140 -947429155 -312786236 -…
Output: 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 999998189 …

Example 2:

Input: 2105 145 557401339 148695881 -702757406 867165745 753097018 -11205613 197583182 305355138 -788219496 -441869761 -385227229 -57429425 -272139743 640415680 345007253 -226614129 -129358562 144717285 32808207 -801298662 -597052912 -694982100 363097910 -946192347 -515075058 575536976 601110819 71423680 178451117 -307139316 -954745550 -239619552 367836915 849807702 -214616910 -518658728 -35866987 275533475 -854164532 792860218 448860890 74048222 -738173647 -792056936 545262371 135473158 355863097 -901251935 979392668 -13958521 771276956 -570170009 -813637544 910215816 -606941871 301784157 567864540 -477094443 622504520 -6665663 -669908751 -75769139 -551105917 -563560353 -290561596 941597272 973980068 -272955463 233915257 -378661034 529545832 -852852054 564144905 -142346532 -979826391 204801947 -…
Output: 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 979392668 973980068 973980068 973980068 973980068 973980068 985729043 985729043 985729043 985729043 985729043 985729043 985729043 985729043 985729043 985729043 985729043 985729043 985729043 985729043 985729043 985729043 985729043 985729043 985729043 985729043 985729043 985729043 985729043 985729043 985729043 985729043 …

Example 3:

Input: 3682 1337 450224679 300928490 -297161914 4973750 800410640 505037837 386864277 -518086021 386173710 -229734648 -537230392 280274104 -4571528 874889645 69475654 192235103 -104205739 529666305 769416579 -388432557 94533349 -819794743 -177053166 682757359 964636985 671521875 793859405 773430379 -524776163 367871719 430578175 -330149789 16874709 898335716 656563536 -315877463 -759780019 592837052 -439953911 -428151799 -403368623 -632909492 602073372 29711827 -195294113 743810694 132913779 -428902163 -752421901 -859295984 -707840626 -501489034 -919090100 131734912 -581457730 76032092 -560665210 620611483 -962517270 802614712 -935186325 926778981 -160835420 133083008 -259785185 -996201719 -570131871 424907725 -875502970 -761920001 936300693 -167197840 428328095 700568685 -349894077 925227343 -36…
Output: 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 998979453 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Woven beacons of Ulric - MEDIUM Coding Problem | CodeTikki