CT45300

Scribe Counts the marks

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Every season at the basalt cliffs of Obsidian Shore, someone must certify the cargo before shipping. This year the task falls to Scribe, armed only with the marks 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: 3596 993 332006609 7810211 -610507873 -30921998 -895790601 -950076857 814189373 462684514 -598816849 242254018 -770651868 -787031865 -955466148 275293239 -193442719 361707576 122189993 -17339766 293230256 211824934 -618849389 198571787 -762935812 85487654 -456821995 919005370 128918919 363872235 188041914 -186980117 -589081855 -583568422 -689396942 604516958 471709608 -902374435 -808532379 862316756 -663401564 -107792546 -324376309 170646737 -751148944 -68302114 730820407 -71326477 -47451770 784561974 -449891888 -280167074 691033185 -13988312 325829650 1941967 664587189 -865458465 911315210 -926328194 -13391584 -614413987 450231585 -252206632 703339068 694396547 630580461 171415319 959234729 515250650 155013880 468566427 208858033 -933205047 -597165951 853836320 268749609 652270111 -891844…
Output: 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 999561590 …

Example 2:

Input: 3958 430 921874802 116293144 687226521 419062568 358565816 525384947 21854863 -942384534 -79957063 489841245 798824574 -203016001 -984608979 -444512302 655562516 -961120171 -939335327 872545944 -728314877 -498469748 -470602968 302305074 588269387 -279967818 -439443425 127991790 -370867393 -142240967 47072678 -953816284 -951280124 657823614 209172557 -759404938 392400181 -484560579 -396246291 720659656 -866825788 104493143 -977060807 -571900819 -470629261 7225539 443971906 -387413348 255104270 567747254 784748285 143581779 564918289 -383216301 -347795147 -242640753 -772034697 -433094146 707800683 -368871002 -24330376 -46136055 -680033501 -140284412 898777809 -848342882 -117268230 692590900 -145509255 -386544002 -561078281 -241051047 -693966130 -582202404 431873409 -75882284 -268011454 81215…
Output: 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 999968735 …

Example 3:

Input: 1630 776 -52890072 394067218 -180840409 490705372 177567253 124070228 -802257526 191899983 -114732041 -710952785 -437918392 932393353 766577736 -793492732 -415912926 810461948 -133227672 -990043849 -77234962 900854573 933152163 152843072 760640140 -982067358 -213337449 841772950 382392144 586179832 -815034617 302744341 -715988767 773986101 -583511206 851978547 -164804609 164353079 279824776 -657331269 114052165 -162721872 892179670 -372294252 -102634458 -520434696 42655600 283006444 195891230 -134728759 182193393 958116249 279905832 179585956 956612440 97889610 561451638 48169843 -378916406 -54081185 234229075 -174395710 -205052325 436795387 -726386169 -689238855 -441787797 149897627 619509034 -462081997 -92584769 -407633539 86233110 38292781 751765739 -707853748 413931405 -153714811 -1531…
Output: 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 998739701 …

Constraints:

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

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