CT56243

Sona's ledgers Taller Ahead

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Before the gates of the poppy fields of Scarlet Plain close for winter, Sona must finish the ledgers ledger - one figure at a time. 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: 134 469860976 427806933 -976260755 413233049 634128408 161028549 -282424395 402156527 830072697 329549622 700616256 808943713 -624834196 -759934865 -611663540 119334452 156034726 -167883785 669144325 -883659287 428964213 -557739343 964596661 59939206 -904975389 -307793425 348265505 -22712441 -306890473 -387908554 -445103811 -369509860 -626222927 463914721 -628870443 -757557530 572291028 -530166027 833666375 565850406 578164329 -423052890 -141047617 -406641245 351928184 745315137 -263409651 -669722945 794056792 -11654654 974934037 993299605 290398570 -446110590 149347852 228352293 988546404 -425951048 249672649 -783716859 400788706 -888359745 -380865875 -624221835 649372138 648187733 437966501 310491786 -322786318 -401212189 687039945 584354442 -461218332 97837702 -216311600 -597236825 1202…
Output: 634128408 634128408 413233049 634128408 830072697 402156527 402156527 830072697 964596661 700616256 808943713 964596661 -611663540 -611663540 119334452 156034726 669144325 669144325 964596661 428964213 964596661 964596661 974934037 348265505 -307793425 348265505 463914721 463914721 463914721 -369509860 -369509860 463914721 463914721 572291028 572291028 572291028 833666375 833666375 974934037 578164329 745315137 -141047617 351928184 351928184 745315137 794056792 794056792 794056792 974934037 974934037 993299605 -1 988546404 149347852 228352293 988546404 -1 249672649 400788706 400788706 649372138 -380865875 649372138 649372138 687039945 687039945 687039945 687039945 687039945 687039945 919523106 919523106 97837702 434910489 12022143 12022143 434910489 434910489 483099170 919523106 -168535696…

Example 2:

Input: 1656 -471644400 154668436 979431803 -807830025 474722323 -258606747 -734808361 181074911 -60292199 -836193742 -852923193 86937215 156743806 517695109 -372761201 347054510 76756780 173398857 -832415603 -444420947 762573239 -274154216 328329045 -738344155 146621889 -923095826 -866829527 -350111965 -284545547 713599679 209184315 -453284820 29864712 282745546 618837426 989320195 597978102 317155431 988440597 832116247 202246583 -108487712 174753787 -209293412 737461608 -373153622 747039080 72555864 -265524351 -193136547 638247019 -669769673 -726571034 -334677651 -220828943 -361066477 126732115 -537006277 -831576126 169268833 684938962 831633016 -148217125 -21725907 -285839125 276973796 919118187 -776847536 -800896617 -419773924 -496569290 372659001 289815855 -817490216 -137795146 939847040 -91…
Output: 154668436 979431803 989320195 474722323 517695109 181074911 181074911 517695109 86937215 86937215 86937215 156743806 517695109 762573239 347054510 762573239 173398857 762573239 -444420947 762573239 989320195 328329045 713599679 146621889 713599679 -866829527 -350111965 -284545547 713599679 989320195 282745546 29864712 282745546 618837426 989320195 995604445 988440597 988440597 995604445 919118187 737461608 174753787 737461608 737461608 747039080 747039080 831633016 638247019 -193136547 638247019 684938962 -334677651 -334677651 -220828943 126732115 126732115 169268833 169268833 169268833 684938962 831633016 919118187 -21725907 276973796 276973796 919118187 939847040 -419773924 -419773924 372659001 372659001 939847040 939847040 -137795146 939847040 955738829 -243793944 110606961 700952748 50…

Example 3:

Input: 924 981192098 194332991 449818442 809281196 -762867959 794065354 140457347 -199668962 954163078 -951323974 -682832110 -22916750 627312564 846817325 528605698 474178518 561682758 511926378 108562107 28093234 -328962557 -157113801 -620432804 981342799 941842079 550781923 -660553784 204366784 735969583 174602978 819664477 3701588 -168358624 651340630 -818880526 -239737807 -136281501 -194377658 -889887671 -76920182 966949089 596022924 -687359878 -354943906 -940782822 -511490532 60778263 -199868146 -754325607 -763129581 580982377 726465759 735946675 449825180 227634482 -146650959 -931439371 -576031163 -881395513 -402068354 -548165760 -392112231 -504424034 218712496 -735739881 506126448 302876765 -597013518 -912629637 509502335 -666462567 493404210 963170873 547831030 80551467 -998069476 5837072…
Output: 981342799 449818442 809281196 954163078 794065354 954163078 954163078 954163078 981342799 -682832110 -22916750 627312564 846817325 981342799 561682758 561682758 981342799 981342799 981342799 981342799 -157113801 981342799 981342799 986465340 966949089 735969583 204366784 735969583 819664477 819664477 966949089 651340630 651340630 966949089 -239737807 -136281501 -76920182 -76920182 -76920182 966949089 972729878 726465759 -354943906 60778263 -511490532 60778263 580982377 580982377 580982377 580982377 726465759 735946675 963170873 506126448 506126448 218712496 -576031163 -402068354 -402068354 -392112231 -392112231 218712496 218712496 506126448 506126448 509502335 509502335 509502335 509502335 963170873 493404210 963170873 972729878 583707209 583707209 583707209 820962020 820962020 820962020 9…

Constraints:

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

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