CT36184

Quinn Counts the ledgers

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Quinn inherited the ropewalk at the quartz ridge of Glimmerfell along with its curious bookkeeping system for ledgers. 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: 3531 2234 -525146991 694962880 739302192 84269484 -896670961 -946875128 -356126100 -668371919 478670647 613614927 -339345752 741019079 -325457626 982087759 676133360 -851617232 -960899447 227754616 -518923892 920261026 -171212308 29559055 -355958835 249806140 -288638918 220707162 -290963251 268272149 202374270 -501322969 825480972 -269089966 -13549074 276220506 440894131 -549770787 -107981716 -330561574 -628206695 774479152 -406401585 977841433 281171656 10831182 66634557 -359460809 288460137 -156506121 -507092864 -363146126 992095440 842715338 -574260261 -492077023 486904115 -973872844 417872905 501636283 -598621667 -491880010 353558934 -431851497 856805020 262073351 285701565 -557187832 -950030423 785331500 -591314804 521269771 -577852110 662706110 -29900178 428537616 389840313 -50315183…
Output: 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 998150475 …

Example 2:

Input: 418 225 -170962558 196522532 -996839906 -547855638 -389773424 515210937 802124369 630202626 373279036 416287824 899796411 79050576 328767787 847503606 -427728834 867968659 382041457 -934148929 81036867 -768758445 618081879 622379400 816887682 -937371100 643513348 -686424986 926211804 -718971952 -374029775 -320731756 244678666 544342239 -278827237 553369995 901893968 -530729168 964552868 -745800883 530532987 -612930408 559312261 957272717 116119999 476172759 186570094 -974009572 -362627544 626807589 -363549206 248100303 58400673 -467219972 -765304369 -399035679 -961153396 -346949537 -412913845 699381210 148647538 -279341172 923795546 -57482104 520159091 -825678776 280656007 -656148777 -188139257 164554617 -732195935 652302828 260868684 -789840458 -718808812 -673382341 34546839 557518219 506…
Output: 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 992460013 …

Example 3:

Input: 2196 1571 -847370143 9265148 726803430 -383802286 692835573 -134974155 513658666 923729151 764380064 -417590178 -83885402 175647157 360259843 972497709 -183891563 2181837 -556604048 679563186 623997772 -602883322 -726828702 -256487926 44808946 229302069 -426608673 896334029 783584970 162682705 607458740 254921739 -562778361 531218814 -411223674 -26945520 169900512 -458599724 252805298 -113283231 838105373 13219532 -984500980 -643071799 -830897919 441272213 -488265775 451734530 -936713826 -740950152 -953694335 150395084 -282002774 504691391 75212864 -777102544 -192227462 686952596 -355031536 -179978674 -464760125 227405307 -558942003 -255964706 310931584 -770926551 -259039288 736056033 893575921 7805453 943431474 638844976 -409299675 345581537 -367986727 873349808 -420771768 -306965337 -814…
Output: 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 997935434 …

Constraints:

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

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