CT40057

Wasim's registers Peak per Window

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

In the acacia flats of Thornveld, Wasim the paymaster keeps careful count of the registers. Restore an old family record, every figure matters. 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: 313 236 57738793 368750092 621871932 -632153440 688494248 731487614 810295506 -693719645 396384279 -460510672 -88272179 513103970 751178777 934590115 -340336638 62732505 919929122 169380878 -616807903 788498886 -706225833 762373012 -213896385 -443895130 -132001901 -143667978 177561122 -492339719 67656572 276442442 142195586 -873535178 27766340 432459191 379677730 -814022494 669772913 -872277448 527119546 16700639 398382558 -968931125 -873761942 -242806987 -950436729 634242004 193725981 -804793150 66801972 -31099638 328963916 561444335 301791809 -959679375 -556850798 -770927097 585150645 46056329 -613819642 407360799 517669108 851626167 -586669999 -16847231 343507945 -342008865 158851477 322800910 -292543990 938188052 369751697 892749678 956033187 -514170817 629307180 -333190829 46380192 -9…
Output: 986246903 986246903 986246903 986246903 986246903 986246903 986246903 986246903 986246903 986246903 986246903 986246903 986246903 986246903 986246903 986246903 986246903 986246903 986246903 986246903 996334459 996334459 996334459 996334459 996334459 996334459 996334459 996334459 996334459 996334459 996334459 996334459 996334459 996334459 996334459 996334459 996334459 996334459 996334459 996334459 996334459 996334459 996334459 996334459 996334459 996334459 996334459 996334459 996334459 996334459 996334459 996334459 996334459 996334459 996334459 996334459 996334459 997399962 997399962 997399962 997399962 997399962 997399962 997399962 997399962 997399962 997399962 997399962 997399962 997399962 997399962 997399962 997399962 997399962 997399962 997399962 997399962 997399962

Example 2:

Input: 1185 232 504053654 729043036 -379653296 997596228 237938081 422698013 -385190978 -424299309 924668542 771239451 884134727 -719580684 -889655369 315003558 967096836 920254393 343411300 740271334 -29633155 -778169417 -90786424 -515030588 704952546 -597679885 -352007548 74707123 857539042 -171497704 -809978706 -390966222 -462787928 -973985048 143488417 -319110513 -142381825 547163912 -645882001 -230482578 67934588 -756131482 -345555516 44729607 681402758 -545543539 -896761089 440224527 277891953 -773886504 -430609218 929087128 408676928 -73789486 -121412897 797153391 110689722 753264262 687829609 704655661 631613521 694454550 -116924879 892268287 148109722 99408997 -896539710 419751009 309575261 142419032 720844736 276160392 -178477519 957701923 -293664541 28532074 -777833436 501438303 308430…
Output: 997596228 997596228 997596228 997596228 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 989753221 996882280 996882280 996882280 996882280 996882280 996882280 …

Example 3:

Input: 1284 6 -421352074 851923966 947494918 -24403355 259329771 -188116553 406295630 248204084 -486513694 -222900967 792018181 -171282748 641554156 678937796 -14430350 -66573212 -436855226 533250942 993781547 110400633 246168971 465903224 -588033843 -251224788 -455928072 214447868 -433799337 -584453292 -850248501 -456419440 995056682 124409718 933162507 55627372 228050501 -93412307 894841570 -872509334 526616603 478786694 59369565 722047951 -170385873 998585819 283130288 560640653 74750657 328032576 -695129758 -40922796 424835463 660549771 30163383 -924544012 -578552456 -764632090 -670882509 745918815 -180133275 713700822 -677748082 691700289 79356112 -757321181 -622620785 941735437 -526909687 -198353346 218474689 228870107 -952168152 -939566263 429784603 -531247034 -51798601 -144280924 -1412795…
Output: 947494918 947494918 947494918 406295630 406295630 792018181 792018181 792018181 792018181 792018181 792018181 678937796 678937796 993781547 993781547 993781547 993781547 993781547 993781547 465903224 465903224 465903224 214447868 214447868 214447868 995056682 995056682 995056682 995056682 995056682 995056682 933162507 933162507 894841570 894841570 894841570 894841570 722047951 998585819 998585819 998585819 998585819 998585819 998585819 560640653 560640653 660549771 660549771 660549771 660549771 660549771 660549771 745918815 745918815 745918815 745918815 745918815 745918815 713700822 713700822 941735437 941735437 941735437 941735437 941735437 941735437 228870107 429784603 429784603 429784603 429784603 429784603 429784603 510809390 510809390 718161161 718161161 718775069 718775069 911435019 …

Constraints:

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

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