CT46491

The Ivory Peak per Window

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Every season at the saffron fields of Marigold Row, someone must plan the harvest festival. This year the task falls to Herald, armed only with the signals register. 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: 2159 1861 612027503 -604063278 778114012 268775280 120155431 -343983612 648034658 -45222886 351337260 349489794 914904160 337257563 273779241 137044402 578764865 -750200811 -164815521 218174973 -356548229 793162732 -272859672 254688591 730753344 -475197142 258007156 478863236 -586270840 695393391 -404255193 -509544950 953586559 294666452 -829751192 -574486291 -372265422 823815920 397483311 23312596 -678345997 -453917600 -963120843 -649202969 762567905 -151374930 -80789221 -90743156 -626572008 173470570 151772146 -941731612 346675398 544156432 -87481777 -298826995 185765366 638654762 -168666736 -555463698 -192893792 -36229629 544995419 -918633570 613460347 -733353055 -109387011 193703594 617064784 -463143786 -442289442 -417305492 -956378214 234539138 -184563968 -365190960 552660337 -1874324…
Output: 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 998397762 …

Example 2:

Input: 3203 1690 41893577 369121496 452293547 466357651 -246610256 56289694 -923408845 427472140 -952701987 964501930 893780059 -269464273 -732117579 325564810 -814101492 469695242 953644660 563437124 -470323562 -435908324 528982283 218647599 454745071 886381327 -588379347 733155236 -188009850 267871266 -915129375 -74787065 -85404222 -980157888 -476848206 493205232 -866697330 234684181 -782101696 14177763 -746322128 -712178975 -306705442 -43748344 -203693025 338028113 155838212 -176726582 -723926305 802022156 -18896467 -761795723 -892947941 153353821 902855148 30465074 -359628053 -806790353 424332204 -291564550 -161533569 -353043789 -638334407 -76423512 693034576 -278803253 -495461399 545178654 -964814723 -347670610 -235335809 774614739 200079770 -129647949 -235743896 -298749522 -342889743 597283…
Output: 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 999800021 …

Example 3:

Input: 946 316 -906854336 -643191201 59737857 948232354 522777161 770417682 -558506855 -224097274 -728131955 -356867207 697938775 -673174721 -686019494 -484652897 -579960280 -42053618 -552087980 -101396835 -840231811 223882831 -378302959 -111582538 99806436 -197496035 -803575402 -836398032 -53844757 73664984 956465514 598156302 495321061 727060911 189246584 767183666 486100 -287912499 783605459 -988101662 -583809230 473694366 -82797518 375132995 913550988 -14178854 -623801853 533375295 886041372 -852941397 129915925 563767991 -499768278 631003090 -712378437 600397282 -610000699 368990658 588283394 -318202642 -858097776 695269164 -465161819 271175525 170129176 75372993 -384119474 -934155535 114269160 -25077779 773836809 -967807257 374891475 627889211 -19543113 73122186 388144773 619017713 28092650…
Output: 980996099 980996099 980996099 980996099 980996099 980996099 980996099 980996099 980996099 980996099 980996099 980996099 980996099 980996099 980996099 980996099 980996099 993670886 993670886 993670886 993670886 993670886 993670886 993670886 993670886 993670886 993670886 993670886 993670886 993670886 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 994963602 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.