CT51763

The Taller Ahead at Greystone

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The council of the shale slopes of Greystone pays by the answer, and Lata intends to earn it. First: the full register of ledgers. 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: 2745 236881552 -9719998 271650292 581972043 58794056 993425610 -815259257 86537873 -311066566 68087768 -908928323 -83448469 -795050834 -539712867 212863938 -86346453 -860825118 -275828793 170731806 -778920112 -383274140 632068307 -575366399 583303417 501320015 890148931 964560396 -429394836 813376832 485362235 -445946088 173601871 380709117 936252895 285330826 555989393 -659477799 146196809 -276351057 382841953 456563678 184862957 759631285 -586730767 -775502704 243636176 -158516319 -507215529 827755847 -695497095 315087210 -169130112 -535324295 -885451213 -117003077 973053024 -307292944 -794964140 -819946733 -798977868 -839948376 758672164 774782543 708248493 -328573646 -49976379 -219925291 42962682 -154633454 915840279 199630346 -715457548 254944699 -327181081 122285852 -585725726 909540…
Output: 271650292 271650292 581972043 993425610 993425610 995940392 86537873 212863938 68087768 212863938 -83448469 212863938 -539712867 212863938 632068307 170731806 -275828793 170731806 632068307 -383274140 632068307 890148931 583303417 890148931 890148931 964560396 973053024 813376832 936252895 936252895 173601871 380709117 936252895 973053024 555989393 759631285 146196809 382841953 382841953 456563678 759631285 759631285 827755847 243636176 243636176 827755847 827755847 827755847 973053024 315087210 973053024 -117003077 -117003077 -117003077 973053024 989662291 758672164 758672164 -798977868 758672164 758672164 774782543 915840279 915840279 -49976379 42962682 42962682 915840279 915840279 962931270 254944699 254944699 909540781 122285852 909540781 909540781 962931270 -609983837 676030713 767331…

Example 2:

Input: 1836 -827864308 959214345 865777090 665169760 622801591 -132361040 92037896 -482553157 277542322 -505562208 -870485638 238097091 -473133177 756577410 953518978 954548087 408132741 438239966 -284408808 -799536662 -417124871 -927542892 659722377 -119624372 609568025 -775988880 58419326 891114198 -161117265 537436772 416915691 901447302 27275731 -269249218 -682320484 -328983968 -251048833 -711068236 526864447 -286157603 -985383914 -679946331 -955065665 191715003 -332333883 -941426259 -394705125 -527556497 -196046323 -163699771 -392064302 -794376856 -557910548 -274880455 826860023 92841038 -558560571 -8613447 615637592 -406453078 -775391088 970386313 -481792351 -563996541 -996419927 876996370 -698859009 -707931865 813820767 221954258 501626443 45667126 721535940 404338707 -991355050 -271476199…
Output: 959214345 970386313 953518978 756577410 756577410 92037896 277542322 277542322 756577410 238097091 238097091 756577410 756577410 953518978 954548087 970386313 438239966 659722377 659722377 -417124871 659722377 659722377 891114198 609568025 891114198 58419326 891114198 901447302 537436772 901447302 901447302 970386313 526864447 -251048833 -328983968 -251048833 526864447 526864447 826860023 191715003 -679946331 191715003 191715003 826860023 -196046323 -394705125 -196046323 -196046323 -163699771 826860023 -274880455 -557910548 -274880455 826860023 970386313 615637592 -8613447 615637592 970386313 970386313 970386313 974413380 876996370 876996370 876996370 937772689 813820767 813820767 937772689 501626443 721535940 721535940 786770512 580026841 -271476199 -49211972 -49211972 145822986 -21639232…

Example 3:

Input: 2874 -730793465 600451651 -926384044 569107175 -2207505 -162623221 -588751511 -242948303 496377847 -145432730 855962346 816194225 -132791725 -315298671 805680957 -945387244 987104626 -904456326 -763819988 -982125294 -380558090 808763375 -702036159 -130712493 869447286 649943827 -616339444 171104541 684983635 541440388 818555972 87061556 872209604 712531794 -190841046 566389766 -867327882 373461263 -57554141 -845041340 -402552110 -547594029 -761411032 417320424 -17300599 861016856 853018863 -866571551 -219408438 -90696231 -279231540 -289965285 -146862980 -758802923 116450413 816380236 243077824 657327784 863787444 13292899 427267114 643804873 685758051 308169832 575552250 736442362 102110894 -900285977 487888135 -814820455 619014598 -972932281 348514711 696965588 245821969 -251313314 247320…
Output: 600451651 855962346 569107175 855962346 496377847 496377847 -242948303 496377847 855962346 855962346 987104626 987104626 805680957 805680957 987104626 987104626 995699291 -763819988 -380558090 -380558090 808763375 869447286 -130712493 869447286 872209604 684983635 171104541 684983635 818555972 818555972 872209604 872209604 901359871 861016856 566389766 861016856 373461263 417320424 417320424 -402552110 417320424 417320424 417320424 861016856 861016856 863787444 863787444 -219408438 -90696231 116450413 -146862980 -146862980 116450413 116450413 816380236 863787444 657327784 863787444 901359871 427267114 643804873 685758051 736442362 575552250 736442362 758791599 487888135 487888135 619014598 619014598 696965588 348514711 696965588 758791599 247320298 247320298 654390083 758791599 537466878 7…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Taller Ahead at Greystone - MEDIUM Coding Problem | CodeTikki