CT51519

Leon Counts the registers

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Morning light hits the dune sea of Caravanrest as Leon unrolls the day's manifest of registers. 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: 1795 -551917103 -483142424 807548295 900086449 666507862 -235134284 796104861 466478775 973862093 -771771553 -591472946 729856672 379912511 426984829 -735467897 -324896367 794530684 -604004595 22493304 945206297 186235517 -417450728 -47563028 -965976999 860346687 567649121 -876567139 701985437 -468857612 369065989 -542463726 495497227 -216429763 285557828 829937820 338842893 44042577 452883620 -93683313 747376084 -707405432 144496686 49446131 -536889701 -202939151 457064858 79370398 -845707505 -455999541 418496240 855463244 -814982601 610152970 646415591 -568579733 619392426 896453673 -655897770 470571936 120023731 407678874 -565272073 -489073515 458040782 289352973 213533351 679612389 -4984550 -756415939 -142535935 -730410428 625611546 843256142 -709271439 -635461327 -163428826 -416837308…
Output: -483142424 807548295 900086449 973862093 796104861 796104861 973862093 973862093 986451690 -591472946 729856672 794530684 426984829 794530684 -324896367 794530684 945206297 22493304 945206297 947936220 860346687 -47563028 860346687 860346687 896453673 701985437 701985437 829937820 369065989 495497227 495497227 829937820 285557828 829937820 855463244 452883620 452883620 747376084 747376084 855463244 144496686 457064858 457064858 -202939151 457064858 855463244 418496240 -455999541 418496240 855463244 896453673 610152970 646415591 896453673 619392426 896453673 905328083 470571936 679612389 407678874 458040782 -489073515 458040782 679612389 679612389 679612389 843256142 625611546 -142535935 625611546 625611546 843256142 905328083 -635461327 -163428826 213697878 213697878 372083161 778009215 77…

Example 2:

Input: 2628 935400284 -711391244 -320427384 292882191 -961883815 837307220 -105421928 977938876 923717573 474595852 -21849050 126721520 -580155938 155902018 930429787 630784755 -507240158 -927401517 180720469 -84778809 226847157 -980460048 -819294807 580327267 -669717022 -447277390 978624055 742070779 -299678108 -345115954 -244207142 -404955285 218876213 -34938898 26903757 -11973572 685783736 509934003 988134904 -245477748 980696920 -185023188 -556330980 751581714 -965449177 603218543 -791654730 -756571997 4026513 68423955 -70221461 737513755 733541228 450545267 269062581 854480145 508353164 449139890 397201081 93866010 380967690 311421196 -922760803 -73938399 -296277147 887450204 682756623 246808567 -765113644 840909845 -458533563 475222821 -739197023 817176196 787340477 -547743723 -247191039 20…
Output: 977938876 -320427384 292882191 837307220 837307220 977938876 977938876 978624055 930429787 930429787 126721520 155902018 155902018 930429787 978624055 978624055 180720469 180720469 226847157 226847157 580327267 -819294807 580327267 978624055 -447277390 978624055 988134904 988134904 -244207142 -244207142 218876213 218876213 685783736 26903757 685783736 685783736 988134904 988134904 997771163 980696920 997771163 751581714 751581714 854480145 603218543 737513755 -756571997 4026513 68423955 737513755 737513755 854480145 854480145 854480145 854480145 887450204 887450204 887450204 887450204 380967690 887450204 887450204 -73938399 887450204 887450204 979166715 840909845 840909845 840909845 979166715 475222821 817176196 817176196 979166715 979166715 -247191039 206681909 777619640 979166715 7290585…

Example 3:

Input: 1929 -161141072 -267032360 750725823 -824447539 -49099442 -193578423 -188638176 229720225 666697832 613920221 863817059 811746172 -688899241 729220190 651672194 -994143264 -265678288 -171734912 -462638804 912849974 992942608 -270548725 -647471189 -580446445 293664052 -657854037 803541707 320794233 -482520735 995070332 -954277280 242239499 -484787163 750337589 945391169 767495883 -42404756 -16674726 -54681394 -996618563 -726390477 -619414805 -245367804 153857104 -805516728 -807069048 -106008277 701091381 -282645567 -881076485 -42598976 757135123 -8399512 -531007156 832187015 -439075197 -930929347 172626617 -892397736 394346426 602672461 105750688 597257816 685051670 723434604 -796649687 232913883 -538910539 -771628434 422518083 -458084057 -395074339 -311812389 -436143536 844931385 737709065…
Output: 750725823 750725823 863817059 -49099442 229720225 -188638176 229720225 666697832 863817059 863817059 912849974 912849974 729220190 912849974 912849974 -265678288 -171734912 912849974 912849974 992942608 995070332 293664052 -580446445 293664052 803541707 803541707 995070332 995070332 995070332 995109962 242239499 750337589 750337589 945391169 971700050 832187015 -16674726 153857104 153857104 -726390477 -619414805 -245367804 153857104 701091381 -106008277 -106008277 701091381 757135123 -42598976 -42598976 757135123 832187015 832187015 832187015 844931385 172626617 172626617 394346426 394346426 602672461 685051670 597257816 685051670 723434604 844931385 232913883 422518083 422518083 422518083 844931385 -395074339 -311812389 844931385 844931385 899206369 794233709 794233709 794233709 899206369…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Leon Counts the registers - MEDIUM Coding Problem | CodeTikki