CT40264

The Taller Ahead Beneath Brineport

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Deep in the smokehouses of Brineport, Peddler studies rows of beacons entries. One clean number will settle the guild's oldest argument. Task: For each element print the value of the nearest element to its right that is strictly greater, or -1. Input format: First line: n. Second line: n integers. Output format: Print n answers space-separated. Constraints: 1 <= n <= 4000; -10^9 <= a[i] <= 10^9.

Example 1:

Input: 3366 -334279449 -538445442 127617529 433895090 -655469824 -787840994 610899754 -576277477 745663154 685228980 -212371666 -216314878 -368437862 -620118775 173104520 365421464 -738475687 -532345566 739112062 451308429 -692796285 -752417069 -499239268 19811808 561220698 -179343714 986309362 838844978 -869875863 -248817640 2136860 528952413 305689580 -571864608 -190994231 385784038 -299217350 12959591 -380398062 -656363788 950519024 75376403 524571958 406018223 788584152 -8278180 -849120359 278751458 66787006 8467919 -496758616 343796025 249992861 -594135815 641415823 812114166 733392423 -912516062 507873885 -895341099 430595698 17990418 -706318569 -926124082 -807806659 669852616 -251229334 -615664979 -992275777 275656415 -157035693 226449830 -578696352 668620913 844761652 925017034 685987389 …
Output: 127617529 127617529 433895090 610899754 610899754 610899754 745663154 745663154 986309362 739112062 173104520 173104520 173104520 173104520 365421464 739112062 -532345566 739112062 986309362 561220698 -499239268 -499239268 19811808 561220698 986309362 986309362 991877068 950519024 -248817640 2136860 528952413 950519024 385784038 -190994231 385784038 950519024 12959591 950519024 950519024 950519024 982053681 524571958 788584152 788584152 812114166 278751458 278751458 343796025 343796025 343796025 343796025 641415823 641415823 641415823 812114166 844761652 844761652 507873885 669852616 430595698 669852616 669852616 669852616 -807806659 669852616 844761652 275656415 275656415 275656415 668620913 226449830 668620913 668620913 844761652 925017034 982053681 744811582 744811582 982053681 -2108135…

Example 2:

Input: 2461 809445471 -977389098 99690717 485583095 910522823 401167297 -495969251 680131944 -703651318 -355846822 51202216 448326753 121993450 -791602458 412198995 -474563957 -579261613 -832873450 -956109810 189991388 -211518852 -280925414 55985914 80962564 -63995763 714458582 -150582014 -757850290 -620518942 -804748316 -495744073 517240182 -889897291 -373141095 301752619 -924007365 -580827696 -703062188 251679782 967566711 280340123 704079713 -95577590 -425773308 687625021 636633977 193632866 921595871 -897189303 351728372 609228062 628331670 312427666 -702680110 242294510 -869420260 621915309 451088576 -702873664 994314805 838839906 848873595 -161505890 -992252243 261416127 284067299 -810805611 -139339987 625100385 -789495697 809403050 931849538 -435560920 547166486 970270080 145067772 -412650…
Output: 910522823 99690717 485583095 910522823 967566711 680131944 680131944 714458582 -355846822 51202216 448326753 714458582 412198995 412198995 714458582 189991388 189991388 189991388 189991388 714458582 55985914 55985914 80962564 714458582 714458582 967566711 517240182 -620518942 -495744073 -495744073 517240182 967566711 -373141095 301752619 967566711 -580827696 251679782 251679782 967566711 994314805 704079713 921595871 687625021 687625021 921595871 921595871 921595871 994314805 351728372 609228062 628331670 994314805 621915309 242294510 621915309 621915309 994314805 994314805 994314805 996348331 848873595 931849538 261416127 261416127 284067299 625100385 -139339987 625100385 809403050 809403050 931849538 970270080 547166486 970270080 994276635 147117628 109487590 147117628 251159753 25115975…

Example 3:

Input: 2484 -307780464 777473401 838949210 797082096 -254569429 -390592818 199892680 6449826 -7744780 -352066713 -825984502 -241647531 969550253 465669547 522992410 724900110 919036781 238234713 911999920 315745625 -291917419 -941560106 -699481126 673755796 157426826 8102538 -97333524 -673383583 561204457 535039437 -446558456 404660718 -514468587 -202762592 -713036874 -133862304 -748048592 -515871451 -807905857 -336700089 223604792 941542395 797893075 -569758162 -402977559 -838953674 -430719073 332411532 269756268 934277558 979327413 -354252483 204369430 722888989 339978199 360486035 -501891764 -224933963 189867356 -799182532 183580305 381367906 -131117952 -941520023 -562074052 36599662 967133630 -336511122 -179675020 428211364 200896689 -954753667 961784222 -954470504 -933886932 718471006 -96957…
Output: 777473401 838949210 969550253 969550253 199892680 199892680 969550253 969550253 969550253 -241647531 -241647531 969550253 979327413 522992410 724900110 919036781 941542395 911999920 941542395 673755796 673755796 -699481126 673755796 941542395 561204457 561204457 561204457 561204457 941542395 941542395 404660718 941542395 -202762592 -133862304 -133862304 223604792 -515871451 -336700089 -336700089 223604792 941542395 979327413 934277558 -402977559 332411532 -430719073 332411532 934277558 934277558 979327413 981350518 204369430 722888989 967133630 360486035 381367906 -224933963 189867356 381367906 183580305 381367906 967133630 36599662 -562074052 36599662 967133630 977513748 -179675020 428211364 961784222 961784222 961784222 977513748 -933886932 718471006 783284309 256787928 -563623202 -20497…

Constraints:

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

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