CT44713

Surveyor and the Ivory marks

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

It is audit day at the glass towers of Prismhaven. Surveyor spreads the marks 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: 1624 991 -694525934 -255706570 -950565425 -301463777 369490052 793913763 850906362 395431352 151961783 -455808281 -606612998 -757414806 -263963829 -220707609 749495688 938299089 -100878180 -451025286 -302260705 -207069114 -254743384 558267805 -415204135 27138568 794053635 484502481 691250757 934509649 -119029639 505937518 421983763 70150044 -746752589 -783491218 -397519885 589303826 -350831734 105351917 -106867973 640185737 216423940 -7890544 236236403 368797873 523240995 -887573371 -399194148 321068032 -460625819 -20821287 -449844002 538318592 -23255819 65973955 -862224268 -805224896 643821290 -909031322 -196810767 610016272 -518216113 389677607 -702410677 371281970 -175332456 -808663216 -842203523 -9423800 15950202 -964508354 -776246169 -170997121 -879253918 -541359588 -660206857 -118059…
Output: 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 997518081 …

Example 2:

Input: 1144 233 -730906641 176013013 569683972 868121855 -108978161 -683743733 -582271451 66688211 894663454 205357789 -476605550 -808551139 363800696 80905404 -704358049 -209898771 -725331285 -755922047 825346665 942675711 352905117 -332855584 445601627 316121797 365567551 396226708 -852570927 145364312 426263086 559860253 435303202 -362151343 455514275 384881686 948540455 -39743116 -861303330 -399955910 245646729 974604502 726617955 885568371 914396086 484489435 -246601088 789349010 388235214 796903717 -328371496 -6670161 -618062128 510947649 -814614232 -392316556 597490187 -873207495 -159192070 -281417022 595221514 143388980 999540716 -18303504 532890056 666897353 -407677902 110299104 -405327571 -82435515 445677265 102210948 -686222186 -579918550 -250605457 -511939308 246203181 -530686267 9652…
Output: 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 999540716 987000489 987000489 987000489 987000489 987000489 987000489 987000489 987000489 995075295 995075295 995075295 995075295 995075295 995075295 995075295 995075295 995075295 995075295 995075295 …

Example 3:

Input: 3738 1467 551926339 640197732 568531429 -11222468 860495614 -406324451 -526489861 -287644985 322598156 726550972 944062275 970034794 -563342470 -856235215 224588754 280647067 -634542967 -993214563 741961908 -481453829 -618349336 -291880102 -367351832 -207477866 761963824 -206104234 787927121 -192232885 -22881101 -538988248 38022508 -434746870 212641009 31937378 970033237 -602727761 -291092264 -106379998 696405426 -146047257 -328096822 327338603 -9980259 -402705283 -761133132 -941855857 220707112 813230038 -460066718 726462441 630926867 320921653 297263778 -900399673 -948721403 -897684385 920910044 556016721 -483325689 437619622 -666766831 -718343535 -938257684 121414519 207191786 -562312816 -368237920 665084022 -303728696 151040196 794366525 -902868951 -318248819 -48235056 -900602849 -1282…
Output: 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 999719226 …

Constraints:

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

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