CT48724

The Taller Ahead Beneath Firefly Mere

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Morning light hits the lantern lake of Firefly Mere as Wren 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: 139 -610288092 847023289 -938209810 -757438518 -230780109 465332874 -522815909 -105018379 -970066248 901928288 -885942197 -937898169 419484844 -170388452 492494977 -874496179 -659305656 940112314 519407243 119461350 788713234 -628038864 -426646731 -702905190 430644668 278770096 702125956 -586484822 -651613510 -380226965 226345511 -466391726 -741538594 636101288 331783738 652451818 -240765039 76261976 -342934269 -805110324 -868830715 -582974326 -256640553 -146904038 403928559 159459025 128131306 -102139646 583227538 -378127326 61161883 -427341019 -573660689 829565764 -428631775 173914903 121922710 667249712 -304128651 -982468592 832591134 167517238 -378805164 -138411682 227518051 -970387234 -746809785 -34197675 -305004672 98822484 -141978367 49706347 233748519 -524678405 -164790917 -9442905…
Output: 847023289 901928288 -757438518 -230780109 465332874 901928288 -105018379 901928288 901928288 940112314 419484844 419484844 492494977 492494977 940112314 -659305656 940112314 951357186 788713234 788713234 829565764 -426646731 430644668 430644668 702125956 702125956 829565764 -380226965 -380226965 226345511 636101288 636101288 636101288 652451818 652451818 829565764 76261976 403928559 -256640553 -582974326 -582974326 -256640553 -146904038 403928559 583227538 583227538 583227538 583227538 829565764 61161883 829565764 829565764 829565764 832591134 173914903 667249712 667249712 832591134 832591134 832591134 951357186 227518051 -138411682 227518051 233748519 -746809785 -34197675 98822484 98822484 233748519 49706347 233748519 718057340 -164790917 718057340 718057340 951357186 350882705 206731646 …

Example 2:

Input: 2654 608450401 423772279 680871849 345578142 -349836409 -714990784 898386957 -950571675 -369763363 457955408 -605307236 346710329 -666645544 790796555 27458201 -108794308 522563224 968113632 239826061 -985490780 626666656 -266247574 -126007607 -738535068 261218655 759112707 -310537698 -560330995 524282556 -272593640 472367434 -436351894 942771263 -979722216 -366640642 313388790 138886398 -522693376 -782116202 556423709 -382033423 -324383975 793545307 26449802 935706451 987572835 -69025170 -247358971 39862178 480798659 774795544 237205158 -952332006 961725661 -586454578 -326049709 -167634614 732456331 629396856 -868598916 294466408 -843383495 142638127 241138923 444062257 846871126 -370003499 843228005 261313733 -507909069 -440447716 -290122912 843478845 -179936753 756523415 124422723 -9188…
Output: 680871849 680871849 898386957 898386957 898386957 898386957 968113632 -369763363 457955408 790796555 346710329 790796555 790796555 968113632 522563224 522563224 968113632 987572835 626666656 626666656 759112707 -126007607 261218655 261218655 759112707 942771263 524282556 524282556 942771263 472367434 942771263 942771263 987572835 -366640642 313388790 556423709 556423709 556423709 556423709 793545307 -324383975 793545307 935706451 935706451 987572835 998528300 39862178 39862178 480798659 774795544 961725661 961725661 961725661 998528300 -326049709 -167634614 732456331 846871126 846871126 294466408 444062257 142638127 241138923 444062257 846871126 942503894 843228005 843478845 843478845 -440447716 -290122912 843478845 942503894 756523415 942503894 247600080 -889631340 247600080 718347181 942…

Example 3:

Input: 958 -40892038 953658542 908540785 -559645958 -261705462 -779778080 76435648 -493322191 -685363404 679506733 -485749603 -197955265 912223848 -849724767 799914967 104467240 -496777059 -278684662 -288913230 884584876 946719691 -418730052 606435428 -474007901 732385631 -270099628 -68290481 148069886 239334416 51230988 -211772734 756839437 625763034 66663413 746527655 -712411569 379353598 -143120809 -362273992 156251486 609501733 -99495318 987639235 939338605 -303821600 -449490627 -145334445 796488321 112064552 368015820 630782725 436426713 151785111 -410284346 -757478119 -967441207 -592535181 -1602769 -553776298 -145854930 292438604 -695820089 892295773 636517078 -949168474 162471193 -630821419 -516713214 935137304 -824355976 -80721651 192685600 143329284 424067946 886536513 636711747 17062378…
Output: 953658542 987639235 912223848 -261705462 76435648 76435648 679506733 679506733 679506733 912223848 -197955265 912223848 946719691 799914967 884584876 884584876 -278684662 884584876 884584876 946719691 987639235 606435428 732385631 732385631 756839437 -68290481 148069886 239334416 756839437 756839437 756839437 987639235 746527655 746527655 987639235 379353598 609501733 156251486 156251486 609501733 987639235 987639235 994520835 984007275 -145334445 -145334445 796488321 892295773 368015820 630782725 892295773 892295773 292438604 -1602769 -592535181 -592535181 -1602769 292438604 -145854930 292438604 892295773 892295773 935137304 935137304 162471193 935137304 -516713214 935137304 984007275 -80721651 192685600 424067946 424067946 886536513 930326763 833150232 211742506 211742506 211742506 59098…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Taller Ahead Beneath Firefly Mere - MEDIUM Coding Problem | CodeTikki