CT65087

Ulric Counts the beacons

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

It is audit day at the observatory of Starfall. Ulric spreads the beacons records across the table and picks up a sharp pencil. 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: 3468 2140 64937473 334239110 600801434 578250316 409098710 928345275 491184611 904326302 58062954 -182482005 104284072 493186439 640797845 -685826794 -546997034 561186644 500229542 30299319 -36493861 -197662001 937846761 342669097 651730384 328903778 637390135 873799642 574482735 -826371974 957817554 -155044931 -734060935 587750387 795324454 -644435105 535051407 238919063 -343046368 502947775 -510016429 -733919719 794793123 628476418 284331842 -36120779 -154909540 368920350 503862399 -183493492 510982940 -358388765 882799030 544180581 -373866637 -99616506 962482794 196997490 -986585586 850909678 -201775846 -837033456 776613005 -8827952 48437476 -964838492 -275518541 909534402 -398336598 -621534357 499972604 655109844 -841764554 988982526 767589455 585355884 308267756 543301618 723437250 29…
Output: 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 997439851 …

Example 2:

Input: 506 309 -939074834 -903214845 -544883702 509242846 548110561 300995236 -919891967 383173850 113738359 -723778719 -342975581 -152924567 -270999996 -146842047 -360444139 -426761069 587961959 436253422 671682317 292761667 297596576 -954336859 563269341 175940355 925648958 986923570 665065265 949775964 36620892 716547183 -442007274 281789354 276061318 942423016 167069769 75126893 30079067 -822521734 231593867 -76590974 721255832 589384631 577928661 -690161307 -172857255 -202946907 502340518 828310204 -102179843 428152330 408444075 -240329367 -964746028 -725861814 -876140135 -226618029 434737686 -487733046 -968217836 973867679 735213387 845976344 473565695 598827626 -497556503 260569951 -691870117 957228961 108541830 -205949321 -313148222 900258038 264245841 -183314789 9854064 -201211703 -85102…
Output: 986923570 986923570 986923570 986923570 986923570 986923570 986923570 986923570 986923570 986923570 986923570 986923570 986923570 986923570 986923570 986923570 986923570 986923570 986923570 986923570 986923570 986923570 986923570 986923570 986923570 986923570 986398461 986398461 986398461 986398461 986398461 986398461 986398461 986398461 986398461 986398461 986398461 986398461 986398461 986398461 986398461 986398461 986398461 992696061 992696061 992696061 992696061 992696061 992696061 992696061 992696061 992696061 992696061 992696061 992696061 992696061 992696061 992696061 992696061 992696061 992696061 992696061 992696061 992696061 992696061 992696061 992696061 992696061 992696061 992696061 992696061 992696061 992696061 992696061 992696061 992696061 992696061 992696061 992696061 992696061 …

Example 3:

Input: 3777 1720 752918436 -773006366 490905076 532415702 154666602 545807743 438819138 -412425413 -982034130 376786503 548743412 933310662 858229265 -188775796 -7739408 252504241 698679878 -839725442 -819549296 667408497 -413684957 480501834 193696194 -288512529 -286535493 -735448053 234259153 -633536065 692285654 10634976 -907948018 -782558584 877877593 -638270992 -942747923 -17324954 -258883273 -317326009 720657939 -142376721 -636001238 -188964664 -224172704 984062535 677170502 -419216619 492089280 786214494 497984370 -211681876 291339804 881587332 491054833 -677872409 -165354570 543664009 -399095695 523472891 -172802065 744391737 -625103347 -771787784 303708337 -409984830 -52394691 -92747419 -229733610 -944910241 -539602310 904021471 559057233 -870010154 -126482210 -185978776 -871986685 -8470…
Output: 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 999166097 …

Constraints:

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

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