CT37424

The beacons Taller Ahead Puzzle

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The ledger master June has been asked to tally the donation drive. On the desk lies a long table of beacons readings. 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: 2214 -90243265 115524722 521503978 165462391 -847294693 11069482 -308651529 -468019356 390958130 640025941 229793256 283218858 512835760 -846221097 -643516510 583453546 568647006 368541883 972459589 -692190840 -888373554 373013820 803068424 -58721075 -955219067 -825319330 684748775 963144596 82187822 179941452 222854580 -493917606 819917180 689551152 581123266 -114282130 -475122668 564151607 -59970306 365037925 176019936 75608683 -386979269 -348093820 436772412 789733177 -494471145 292011230 641950492 469339667 410682827 482775707 -531533219 -514551298 879555990 -232057694 -675798855 -823611126 -22369142 905442637 88422463 -68963134 -603812817 -72607284 262732363 652938963 -408801126 -201348572 -452642171 -380261011 -765192437 186605984 582092088 905450193 872067979 83050348 -874200085 930…
Output: 115524722 521503978 640025941 390958130 11069482 390958130 390958130 390958130 640025941 972459589 283218858 512835760 583453546 -643516510 583453546 972459589 972459589 972459589 998325539 373013820 373013820 803068424 963144596 684748775 -825319330 684748775 963144596 998325539 179941452 222854580 819917180 819917180 879555990 789733177 789733177 564151607 564151607 789733177 365037925 436772412 436772412 436772412 -348093820 436772412 789733177 879555990 292011230 641950492 879555990 482775707 482775707 879555990 -514551298 879555990 905442637 -22369142 -22369142 -22369142 905442637 905450193 262732363 262732363 -72607284 262732363 652938963 905450193 -201348572 186605984 -380261011 186605984 186605984 582092088 905450193 930662199 930662199 930662199 930662199 998325539 774548116 84810…

Example 2:

Input: 753 672713750 765345363 294208945 -166916550 730225530 929028945 -686668885 316529885 -748742776 -965759920 149957430 -215490287 818113145 -621060003 376646879 -170951434 183676127 -812620739 472444450 -603353897 -223476875 257730917 799095077 43584589 -838623133 898431871 -889601215 -749033302 776821811 -682106465 103452768 390059492 -661958485 -419014166 -932544372 -113779695 -261331626 507951913 -841925411 -915077082 86938378 -487154077 -33145045 491710981 836868500 96364602 -106469423 -317826826 -555989564 911861847 237803550 -291656822 899549184 -938247244 711779473 -973604256 -875436140 -6478455 -381368746 472269438 -9050222 -993916934 815694611 605499646 -841708508 -730868876 896890156 -879177641 302637610 -82035936 24007359 913832464 -397373825 -134830939 901388385 526173060 -67357…
Output: 765345363 929028945 730225530 730225530 929028945 936702543 316529885 818113145 149957430 149957430 818113145 818113145 898431871 376646879 472444450 183676127 472444450 472444450 799095077 -223476875 257730917 799095077 898431871 898431871 898431871 911861847 -749033302 776821811 836868500 103452768 390059492 507951913 -419014166 -113779695 -113779695 507951913 507951913 836868500 86938378 86938378 491710981 -33145045 491710981 836868500 911861847 911861847 911861847 911861847 911861847 913832464 899549184 899549184 913832464 711779473 815694611 -875436140 -6478455 472269438 472269438 815694611 815694611 815694611 896890156 896890156 -730868876 896890156 913832464 302637610 913832464 24007359 913832464 936702543 -134830939 901388385 936702543 674040633 -195266415 180409601 180409601 34986…

Example 3:

Input: 847 -357275350 87154002 295979675 -438994338 69132698 -767357407 -337651707 882207274 -153919691 -653445897 876499002 652955282 -912524593 680571316 277273980 -556952385 -709013411 -776986658 -507411712 50581653 222291120 236790809 -347271760 -742842234 489574378 -918275608 -384328463 904137860 -630130729 -420565956 213323783 454351926 -122371325 578034234 681407691 -567197984 -232251353 -384064511 10722081 451124189 -713269 -34374232 -343997957 -589844606 -651848694 -728652916 826567496 -127291532 547613541 182733682 -467509295 260945661 -529302666 43980977 -154994782 282731184 915655911 506280819 313331191 650995895 762260116 12372920 868476303 605568394 206960416 855660011 -204698534 -773963494 -717978233 -673860471 -972978111 677043273 -893407540 -739107377 -154826146 532087834 5127160…
Output: 87154002 295979675 882207274 69132698 882207274 -337651707 882207274 904137860 876499002 876499002 904137860 680571316 680571316 904137860 489574378 -507411712 -507411712 -507411712 50581653 222291120 236790809 489574378 489574378 489574378 904137860 -384328463 904137860 915655911 -420565956 213323783 454351926 578034234 578034234 681407691 826567496 -232251353 10722081 10722081 451124189 826567496 826567496 826567496 826567496 826567496 826567496 826567496 915655911 547613541 915655911 260945661 260945661 282731184 43980977 282731184 282731184 915655911 922498312 650995895 650995895 762260116 868476303 868476303 907144322 855660011 855660011 907144322 677043273 -717978233 -673860471 677043273 677043273 780729810 -739107377 -154826146 532087834 661421042 661421042 661421042 780729810 79626…

Constraints:

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

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