CT43001

The Violet Taller Ahead

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Morning light hits the silver mines of Lodebarrow as Kian unrolls the day's manifest of beacons. The tally will decide the next shipment. 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: 3384 672978026 -476738670 742065683 788717500 -501667409 -36914381 -564585515 158286210 891993238 -518045399 779601360 -179942116 -378951680 -886397962 856037426 822123911 350544383 -549642983 51266904 642535771 -41233432 -660605548 -546117350 520177447 -662558157 790236198 857904279 -945782408 667199035 -247162986 -439472519 620525681 -181539913 614148176 592321141 -449603658 -443461685 -259661768 -621430625 -427843569 -807021772 -177707855 620160174 534634953 500686989 -724726532 688951041 -396708480 -798129935 297862458 522774775 833267343 -231752677 -791802440 -25799808 -26278972 -706483009 113191400 -835817367 -984649204 -635728535 -287760067 -690729756 985857401 -385322439 -983566340 267001204 -492692466 -882431495 915962252 897417149 743818851 -380692613 -660828512 -395087478 -34032…
Output: 742065683 742065683 788717500 891993238 -36914381 158286210 158286210 891993238 985857401 779601360 856037426 856037426 856037426 856037426 857904279 857904279 642535771 51266904 642535771 790236198 520177447 -546117350 520177447 790236198 790236198 857904279 985857401 667199035 688951041 620525681 620525681 688951041 614148176 620160174 620160174 -443461685 -259661768 -177707855 -427843569 -177707855 -177707855 620160174 688951041 688951041 688951041 688951041 833267343 297862458 297862458 522774775 833267343 985857401 -25799808 -25799808 113191400 113191400 113191400 985857401 -635728535 -635728535 -287760067 985857401 985857401 986898078 267001204 267001204 915962252 915962252 915962252 971246582 971246582 821573030 -340324423 -395087478 -340324423 151192817 151192817 151192817 62521525…

Example 2:

Input: 1021 829129719 -194639964 648715641 951102655 -538343042 -559801087 406565824 109958554 200352638 -755677724 122091663 397863724 -487588341 831079816 -131754143 -436015147 -723619753 385887647 712568703 -921106202 -901210275 966137526 495166925 -996550093 -789618279 872339888 995286486 -30637309 -814794806 304020704 -672112931 38715079 309245773 -751836121 191470739 -187780200 984551930 -548911197 740959608 535085411 -603144841 -205022554 -587492335 821151207 -176065022 201464891 -61911574 427691402 -358607010 559317179 -262598906 -219118277 -842344116 884019029 -387942765 787995370 113592692 -388606427 -899565542 689955239 715432570 -290081507 374623886 -414696390 -78532096 836912742 23392522 670273311 -616663586 201849728 -771322060 -220984941 -961090843 153423672 -257311993 746578232 -5…
Output: 951102655 648715641 951102655 966137526 406565824 406565824 831079816 200352638 397863724 122091663 397863724 831079816 831079816 966137526 385887647 385887647 385887647 712568703 966137526 -901210275 966137526 995286486 872339888 -789618279 872339888 995286486 998721328 304020704 304020704 309245773 38715079 309245773 984551930 191470739 984551930 984551930 994910907 740959608 821151207 821151207 -205022554 821151207 821151207 884019029 201464891 427691402 427691402 559317179 559317179 884019029 -219118277 884019029 884019029 969573766 787995370 836912742 689955239 689955239 689955239 715432570 836912742 374623886 836912742 -78532096 836912742 841652511 670273311 746578232 201849728 746578232 -220984941 153423672 153423672 746578232 746578232 841652511 743003771 841652511 969573766 -22912…

Example 3:

Input: 787 -785309056 671139829 159617131 -248504596 -380281548 709621701 -738044047 100110423 -54977857 176803969 345504913 748906918 -809678714 -850700733 -523925496 275504422 678866152 -462308738 503104349 -345689679 -814601774 868396624 237353731 -494242092 -719548141 961118265 673190415 -132360700 -68200666 -54416291 380534353 515917184 -460037153 418923706 941502120 635660824 251327235 263301878 612906224 508194340 -851853817 -914141427 -990620168 171102904 -551181089 -898405917 -300435279 949468509 864638728 127773078 710570562 217748451 -222077547 -478680233 -696024114 173807582 -524152391 865695560 313132172 -480839175 248572148 661099629 314401935 886846428 -789283879 -553209281 -810175591 -36114686 -957691171 -259749578 -331460962 -5597930 937915175 -833825873 -257951137 -315819104 814…
Output: 671139829 709621701 709621701 709621701 709621701 748906918 100110423 176803969 176803969 345504913 748906918 868396624 -523925496 -523925496 275504422 678866152 868396624 503104349 868396624 868396624 868396624 961118265 961118265 961118265 961118265 984095865 941502120 -68200666 -54416291 380534353 515917184 941502120 418923706 941502120 949468509 949468509 263301878 612906224 949468509 949468509 171102904 171102904 171102904 949468509 -300435279 -300435279 949468509 984095865 865695560 710570562 865695560 865695560 173807582 173807582 173807582 865695560 865695560 886846428 661099629 248572148 661099629 886846428 886846428 937915175 -553209281 -36114686 -36114686 -5597930 -259749578 -5597930 -5597930 937915175 984095865 -257951137 814724176 814724176 905670909 -226004094 -226004094 6673…

Constraints:

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

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