CT47943

The Violet marks of Kavya

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Before the gates of the boar woods of Tuskmore close for winter, Kavya must finish the marks ledger - one figure at a time. 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: 1350 1204 -696466823 184836483 -611896403 894298877 863731279 -989646102 117375920 223547642 -800333339 -497619615 -420183709 413919279 -923980133 636225112 263301597 -832953489 -665977737 707401074 250554192 -544690411 -249872456 370004983 -605703230 748685898 -593124823 228321966 477653259 -216800743 632636221 648966524 -617709111 -466208339 -842890928 -123601794 -397125244 -618491159 264112816 70555811 -336405716 -480347185 -595111497 -260889943 229840893 133309330 -367008513 -680206183 -54088116 512085465 -138873776 -284820470 -579605017 667130990 572269620 916353417 -195740714 389136830 433629911 980108506 -41912210 -50504848 750045050 -516210273 -555014896 342913161 -5060422 207532908 9821966 -882768965 -272199851 -354286969 248588595 539108800 389507365 -137418569 841826454 16671923…
Output: 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 998732038 …

Example 2:

Input: 279 151 401643217 543191559 347168839 -37292620 430701777 -639254689 818632521 706696701 375967766 629093764 332835563 988954366 958003458 533127235 929020983 419889058 -597223831 157908639 169731145 -109689865 -193717020 613567492 -35653151 -964195996 893422361 -928398372 -375935010 -221493727 -901800781 840237649 954781900 -773431968 264991365 -903586879 -963691063 747552647 -280371675 241072367 154001120 -396280547 912510095 -13916269 -502609225 223264733 -153643160 325648571 336123689 -7278956 -610881597 678271068 -736128024 -406020647 -594785887 -934086182 692794861 -869539900 -993804199 -33209967 -931478382 704944676 4410407 369790202 -620732239 650845398 -208671783 542692135 523712706 936864099 268201974 -347172048 438237671 -767277984 842892025 -465980612 -82843127 702416104 -32185…
Output: 988954366 988954366 988954366 988954366 988954366 988954366 988954366 988954366 988954366 988954366 988954366 988954366 958003458 954781900 954781900 954781900 954781900 954781900 954781900 954781900 954781900 954781900 954781900 954781900 954781900 954781900 954781900 954781900 954781900 954781900 954781900 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 950509788 …

Example 3:

Input: 2667 2024 -631470162 663619399 965123310 -787783764 -564417362 840185486 -243336409 351682280 -23872794 -359109298 120469107 943048062 471510509 -439125783 191400496 -648398156 235578043 209158242 163797871 -221196636 -751763841 339939853 127699579 -272889211 -476071124 -94519319 246490045 -213087580 817044340 -786365138 355157516 516769509 -504998186 -912945933 584419655 -780720584 892410892 -396243387 664518107 46622128 258854122 -646873048 331090623 969834169 -615856888 -954268010 -665597204 -278846683 85710226 -227807045 -443202728 -351852135 -391791757 48269782 899058264 246170725 394651324 48082757 -442103125 350090625 -44913444 -190406566 5434882 -971585462 49397279 89736750 -653660632 -806397962 -663052821 425798960 -153882602 360078629 937010885 -837196878 -414206209 -607973351 -8…
Output: 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 997326651 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Violet marks of Kavya - MEDIUM Coding Problem | CodeTikki