CT54360

The Taller Ahead of the Shimmering marks

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

In the sulphur springs of Brimstone, Zaid the factor keeps careful count of the marks. Reorganize the archive shelves, every figure matters. 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: 3093 707129735 758038439 -210397064 220427361 -392123282 710624610 -58749378 751476250 -621250039 -533833764 -458748938 -544373513 12264043 -644559280 71011558 766184661 998124953 -140484145 279179954 -66376757 -58155737 58104999 518986542 993811177 -305121874 579765149 -475120931 700962138 -805354000 554085570 197361265 893047398 -544389942 127531959 698172336 -890015802 286402910 -538661008 829029537 428500062 -612313450 -155611736 971151358 118120552 710167531 820572990 388304556 60371120 -295640664 96551332 801448753 -951405798 325567183 476430631 -33180638 438374241 883793344 -289192880 816701058 -225160591 280570169 265067045 615839115 745190218 -901799123 263443633 499376635 783916285 607262998 688409654 575523121 -127058432 -367165871 -448793782 -915721959 -619924715 -211147865 663…
Output: 758038439 766184661 220427361 710624610 710624610 751476250 751476250 766184661 -533833764 -458748938 12264043 12264043 71011558 71011558 766184661 998124953 998445318 279179954 518986542 -58155737 58104999 518986542 993811177 997229833 579765149 700962138 700962138 893047398 554085570 893047398 893047398 971151358 127531959 698172336 829029537 286402910 829029537 829029537 971151358 971151358 -155611736 971151358 987342272 710167531 820572990 883793344 801448753 96551332 96551332 801448753 883793344 325567183 476430631 883793344 438374241 883793344 959781963 816701058 828411050 280570169 615839115 615839115 745190218 783916285 263443633 499376635 783916285 828411050 688409654 828411050 663429367 663429367 -211147865 -211147865 -619924715 -211147865 663429367 828411050 959781963 608374944 …

Example 2:

Input: 598 -239851359 -179895890 427821988 -248465594 901491592 624368532 -835519350 -599283720 180092045 -893469162 968110190 625533387 995328507 610080653 -436814276 -860304380 -810113857 -607626652 -1424032 -448801883 194100881 366243468 771967396 906027867 857777479 426897736 761832396 -748544926 -136709337 -143640979 676269026 -898774211 -89489089 -973937231 -125563031 279142662 -63262132 228549723 -922024681 -566723785 732805096 762989280 -52807279 500430177 -134603732 371381883 -641834656 336910624 463852366 34905856 -522593441 759943048 615112422 94361206 983382547 -817007976 -799623961 -341869900 758491629 784120359 -357902507 762057966 -854578425 -918022489 -951165363 -89428731 612639326 -871890466 721656585 73410721 -234285285 896126145 -596277379 -753969559 903943820 -135623236 -73359…
Output: -179895890 427821988 901491592 901491592 968110190 968110190 -599283720 180092045 968110190 968110190 995328507 995328507 -1 771967396 -1424032 -810113857 -607626652 -1424032 194100881 194100881 366243468 771967396 906027867 983382547 983382547 761832396 762989280 -136709337 676269026 676269026 732805096 -89489089 279142662 -125563031 279142662 732805096 228549723 732805096 -566723785 732805096 762989280 983382547 500430177 759943048 371381883 463852366 336910624 463852366 759943048 759943048 759943048 983382547 983382547 983382547 987405471 -799623961 -341869900 758491629 784120359 896126145 762057966 896126145 -89428731 -89428731 -89428731 612639326 721656585 721656585 896126145 896126145 896126145 903943820 903943820 903943820 926236968 763672848 -663481027 763672848 883152175 883152175…

Example 3:

Input: 224 -655916811 594070191 82565801 454816182 -434005245 894882383 -354895954 -798700052 -178586166 771839936 189365207 -25321991 296160732 608706684 512450755 130356771 452637069 -235029110 87106592 128677303 599941536 -427691764 484610435 -726367015 -871504200 930251904 599402655 -773198263 107284253 -348827182 -327359221 -980739927 -445801812 912847734 -452808096 291400786 715070120 464139151 181456674 639106632 -196766240 -656196468 -926779001 -620176057 -96849610 -567231360 301328330 743215582 967998092 642422576 -424800816 675280011 -489988573 -161859697 841688812 -305597318 442835202 -968973541 -884881062 -562178529 -89908601 -956466396 926287753 431924742 -695601776 499052234 950451843 390362678 379400716 -226896590 -366901167 656467799 518630869 255397021 772348958 42992899 -7089124…
Output: 594070191 894882383 454816182 894882383 894882383 930251904 -178586166 -178586166 771839936 930251904 296160732 296160732 608706684 930251904 599941536 452637069 599941536 87106592 128677303 599941536 930251904 484610435 930251904 930251904 930251904 967998092 912847734 107284253 912847734 -327359221 912847734 -445801812 912847734 967998092 291400786 715070120 743215582 639106632 639106632 743215582 -96849610 -620176057 -620176057 -96849610 301328330 301328330 743215582 967998092 978070329 675280011 675280011 841688812 -161859697 841688812 926287753 442835202 926287753 -884881062 -562178529 -89908601 926287753 926287753 950451843 499052234 499052234 950451843 978070329 656467799 656467799 656467799 656467799 772348958 772348958 772348958 819262903 732366474 -439495782 732366474 819262903 9…

Constraints:

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

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