CT42331

Hope and the Taller Ahead

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The harbor bell rings at the marble forum of Argentium; Hope weighs the day's beacons manifests and starts the calculations. 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: 1427 795714456 -257599736 -517312797 -23569057 -649589469 945802632 73989803 -814161933 38930513 -477900220 -740131107 572903408 -902990900 -24075133 -75206016 65464979 -615680932 982370349 -736958103 -65387799 -741300288 971880657 872940839 -379829561 -988800006 479911637 -753502033 191756542 -327911162 178994859 839519458 -398931777 817352162 589536477 -308445740 -345531485 -37997663 157100979 -145207705 -704394567 -11251020 801219719 834572332 31046148 851244149 855185586 -596862089 704057016 12718570 318912561 80657982 47316162 370942639 -71171990 -110835414 792694701 -281563443 -120346730 700560245 537302428 -137110462 98871889 -901901939 -990430479 560410875 -324219109 707166799 49821451 780334356 -930004085 712285606 -132438974 375647582 705573168 -695627905 -786330852 260197728 -67…
Output: 945802632 -23569057 -23569057 945802632 945802632 982370349 572903408 38930513 572903408 572903408 572903408 982370349 -24075133 65464979 65464979 982370349 982370349 983625097 -65387799 971880657 971880657 983625097 957035018 479911637 479911637 839519458 191756542 839519458 178994859 839519458 851244149 817352162 834572332 801219719 -37997663 -37997663 157100979 801219719 -11251020 -11251020 801219719 834572332 851244149 851244149 855185586 957035018 704057016 792694701 318912561 370942639 370942639 370942639 792694701 792694701 792694701 957035018 -120346730 700560245 707166799 560410875 98871889 560410875 560410875 560410875 707166799 707166799 780334356 780334356 957035018 712285606 957035018 375647582 705573168 957035018 260197728 260197728 460538366 460538366 460538366 957035018 983…

Example 2:

Input: 2548 -316180028 -470000768 532334493 -445462997 845908640 932906857 181573907 -613264810 -882033327 -615846791 488693314 -960713912 47269293 558506145 392410946 764946633 923823236 254439295 -30996014 -450279401 904506637 856701786 271790364 -706112490 -358892434 -436186378 -123955280 183914195 -983253013 360098435 -284211891 -873515395 82899501 609721236 -737975138 -444388195 -363153362 508596897 -970827936 636644664 414029603 685757375 -394838991 374419583 413211822 720529661 -869558 566306997 -925435615 273313971 879756122 26124542 442607586 -197072466 -535670141 -681841833 -78382924 -421719545 771521345 857951153 837779752 -473513837 121841152 -634479866 852879345 960259853 589076416 157862348 718629475 -956441392 -208597529 443866440 -463196587 274814666 -148489148 -165080190 -1190679…
Output: 532334493 532334493 845908640 845908640 932906857 960259853 488693314 488693314 -615846791 488693314 558506145 47269293 558506145 764946633 764946633 923823236 960259853 904506637 904506637 904506637 960259853 879756122 360098435 -358892434 -123955280 -123955280 183914195 360098435 360098435 609721236 82899501 82899501 609721236 636644664 -444388195 -363153362 508596897 636644664 636644664 685757375 685757375 720529661 374419583 413211822 720529661 879756122 566306997 879756122 273313971 879756122 960259853 442607586 771521345 -78382924 -78382924 -78382924 771521345 771521345 857951153 960259853 852879345 121841152 852879345 852879345 960259853 975262353 718629475 718629475 731464615 -208597529 443866440 731464615 274814666 369749093 -119067998 -119067998 369749093 731464615 731464615 7314…

Example 3:

Input: 1304 385565218 101312216 -44347670 1943064 -735279645 330514156 660238080 -437145716 619455585 -616583024 720071525 -123294422 852211206 -415562196 128525421 -482659677 -648931853 -279740992 372972734 -88916295 635915644 -703731951 -141697943 710228452 -279316537 -12110239 -807238965 -410456104 660098465 327033616 -748775746 -920550055 664524750 926120650 -462502221 -719038902 769381483 -394215365 245754383 556081890 -273232246 82667581 -337714396 465439780 -604363759 -989795313 -591895865 492404405 331408184 -615659923 793657785 757404624 -954234363 978576781 934144221 -264351410 508442931 -140036643 -123957994 -178876447 648420227 150690002 -249931440 -368334035 -278269519 593405695 378007897 299589803 221186730 816970717 -27656461 -416666113 106070410 664023006 -150335069 281226901 -877…
Output: 660238080 330514156 1943064 330514156 330514156 660238080 720071525 619455585 720071525 720071525 852211206 852211206 926120650 128525421 372972734 -279740992 -279740992 372972734 635915644 635915644 710228452 -141697943 710228452 926120650 -12110239 660098465 -410456104 660098465 664524750 664524750 664524750 664524750 926120650 978576781 769381483 769381483 793657785 245754383 556081890 793657785 82667581 465439780 465439780 492404405 -591895865 -591895865 492404405 793657785 793657785 793657785 978576781 978576781 978576781 998824343 941245918 508442931 648420227 -123957994 648420227 648420227 816970717 593405695 593405695 -278269519 593405695 816970717 816970717 816970717 816970717 825618239 106070410 106070410 664023006 727610210 281226901 727610210 -419713260 727610210 825618239 8256…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Hope and the Taller Ahead - MEDIUM Coding Problem | CodeTikki