CT54524

The Peak per Window at Whitestone

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Before the gates of the alabaster quarry of Whitestone close for winter, Silas must finish the ledgers 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: 2667 739 -903547433 -558944415 920076694 673778536 -233139852 836013174 -40319905 869316122 -239120889 884876014 -858964555 -847056524 -220952973 -760143844 -855980226 -969797245 309897341 875916592 -676128603 472885871 -721706053 -690066477 245441482 -850568592 13120582 741967186 348965357 -57090437 -617157524 646125407 180664089 -108195041 323591164 432481805 206245363 914896967 897125507 -425047363 733515399 429875889 -53962913 156564408 425456944 -329355416 -641838893 -747432495 168966598 -237230103 -271650693 298747296 796794822 536347887 -724201257 -207571942 -821971430 -145516365 557238858 -139456561 -145587210 944670753 -205176058 749580926 946447446 -189275385 537155733 -115563588 -410739107 -545215211 -746352878 51609691 568896612 -730726308 -174798499 -521581842 -941102302 -5796…
Output: 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 999124508 …

Example 2:

Input: 2663 1371 -748101179 492801273 348332254 56350020 -534082376 -573364314 577976405 882168373 -943850342 -250692759 -26426483 -5762553 -280651566 -517883085 323761047 -935645116 215546647 -600806308 419629362 -87954880 699977453 -786078685 -323761829 428416114 95380291 405815083 -916327278 736465583 -313711474 -155826457 271661004 -315157481 291151712 123255782 214097705 316207547 528521896 -846652144 152046870 -804689843 -248945066 330380028 55804471 763604954 797604551 -923441397 -505530796 -221312877 -374308916 -789210325 518728718 -692602834 -755368161 -173081098 -559619311 -466032559 -173454340 -566468165 664343580 -205418887 843666584 934590634 316504288 767592680 -856768489 -784535491 -578159306 246685703 517322754 328652835 -549591270 -304309824 -641960873 -993578760 -813438990 93316…
Output: 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 998616202 …

Example 3:

Input: 3722 616 863536919 879171612 -330645468 -634620476 299657742 478677347 -401177879 -903222876 -915631165 -161991997 -346090678 -561420444 -552372924 907298736 -138001924 640033903 529029435 -232029266 -179075177 -774351575 -167034313 -540104354 -336459830 -561517798 846554223 -935006444 -227306581 854693034 772957476 405892756 -171023748 -835450321 358077639 828353051 -758600304 -204743114 -572508687 559183546 -959811602 -235053244 -21685388 -30866527 722989880 813229493 -484124641 -954213954 -421079464 956909968 887469680 864509705 351561371 81466005 -582935191 -985614213 -85518335 -46503934 -475430881 645589395 -976534407 819669907 -244619724 -781236054 -75114052 -431739258 599596931 724306345 -444289477 819671746 421973489 -315685265 -395404792 934820190 -172771051 -611933944 -424998220 …
Output: 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 997304084 …

Constraints:

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

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