CT37942

Pavel's signals Taller Ahead

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

At the quartz ridge of Glimmerfell, Pavel records each signals in a worn leather ledger. The guild wants answers, not guesses. 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: 1030 884711943 -965770246 417803289 -450691510 987785364 838698034 -760829198 -991207761 -124495408 -266127811 -494584068 -398482140 -870094200 -294414594 213233454 -611718029 762091668 19127762 6275648 792780062 97030844 -684924241 -333813878 163610869 -620336953 -834073682 141842455 922931664 945042805 275087996 -206445783 -45484945 -662336991 -55467355 653316051 876035862 810835964 17385204 920751881 -364391448 919984248 719978755 363454432 994081264 -189625971 -517409015 -294113381 578759926 216854043 447201336 -19912509 -754033449 988633623 -337418600 167020578 806850260 454564433 -239247796 -665935332 -384348550 -861509249 16972408 173417998 -515986085 455029963 329523993 263782656 -98439618 -285278205 -371122297 13189072 963310740 132249754 605701165 491712608 859273603 394905558 -7…
Output: 987785364 417803289 987785364 987785364 994081264 922931664 -124495408 -124495408 213233454 213233454 -398482140 -294414594 -294414594 213233454 762091668 762091668 792780062 792780062 792780062 922931664 163610869 -333813878 163610869 922931664 141842455 141842455 922931664 945042805 994081264 653316051 -45484945 653316051 -55467355 653316051 876035862 920751881 920751881 920751881 994081264 919984248 994081264 994081264 994081264 998414599 578759926 -294113381 578759926 988633623 447201336 988633623 988633623 988633623 991075776 167020578 806850260 963310740 455029963 16972408 -384348550 16972408 16972408 173417998 455029963 455029963 963310740 963310740 963310740 13189072 13189072 13189072 963310740 991075776 605701165 859273603 859273603 907114018 667187986 -235837772 -188937382 -82125…

Example 2:

Input: 2332 -210014107 147819020 594529449 -827948416 -181629056 -564704205 -750011170 -381193384 -640045220 -647357779 474168483 466502512 -522626646 243886723 992264551 905847011 -626696765 485854912 -386979625 730632231 -91244443 403635588 887681509 512868742 8807711 -860959295 -9243174 900390474 319381690 -235321060 719767295 -551911742 913738191 57914112 690516946 34574315 731914114 521817988 -826692194 -150713528 579695150 967542801 -810657965 -308392343 768594028 -736931407 -539974697 568077378 370956511 -549517966 272203927 -813945079 827810289 112252917 -256806302 -708290352 -949096245 985250420 234561724 209580076 419950301 20472893 -348760355 18930959 -841294777 630554255 685321077 -609618672 -148343742 836866563 -893337091 -811210202 -371985429 976968752 133467979 392433942 -252196482…
Output: 147819020 594529449 992264551 -181629056 474168483 -381193384 -381193384 474168483 474168483 474168483 992264551 992264551 243886723 992264551 999444506 913738191 485854912 730632231 730632231 887681509 403635588 887681509 900390474 900390474 900390474 -9243174 900390474 913738191 719767295 719767295 913738191 913738191 967542801 690516946 731914114 731914114 967542801 579695150 -150713528 579695150 967542801 985250420 -308392343 768594028 827810289 -539974697 568077378 827810289 827810289 272203927 827810289 827810289 985250420 985250420 985250420 985250420 985250420 999444506 419950301 419950301 630554255 630554255 18930959 630554255 630554255 685321077 836866563 -148343742 836866563 976968752 -811210202 -371985429 976968752 999444506 392433942 499418152 309059415 309059415 499418152 499…

Example 3:

Input: 138 -212743297 558198705 -37312861 -504488203 -863869408 -483894881 -897805652 -362523124 851314146 444012587 -595046900 336667716 569089617 -298240517 -984503949 587336881 -900579677 -480995655 -814269840 -137641485 583460650 674905874 423217735 15428143 810581899 -793657388 780541407 -300825786 -710245522 831971590 759586993 651327171 -320201830 -794969828 977545273 629237743 -820579850 371578730 647608575 531822633 -647159178 -46000172 -905633014 32188618 755121795 -881143343 -146543817 867810209 -394356028 -172301001 580605765 -793166247 -845874865 933577399 553625176 -755840055 -68573867 424562476 856465570 -981899277 -165358580 762979470 252611114 73387346 -177383339 -67225390 391833695 733112057 -398081782 -258490116 -460648709 718454346 476384028 434274400 -57190690 -266902327 -851…
Output: 558198705 851314146 851314146 -483894881 -483894881 -362523124 -362523124 851314146 977545273 569089617 336667716 569089617 587336881 587336881 587336881 674905874 -480995655 -137641485 -137641485 583460650 674905874 810581899 810581899 810581899 831971590 780541407 831971590 831971590 831971590 977545273 977545273 977545273 977545273 977545273 -1 647608575 371578730 647608575 755121795 755121795 -46000172 32188618 32188618 755121795 867810209 -146543817 867810209 933577399 -172301001 580605765 933577399 933577399 933577399 -1 856465570 -68573867 424562476 856465570 925243611 -165358580 762979470 925243611 391833695 391833695 -67225390 391833695 733112057 925243611 -258490116 718454346 718454346 925243611 630163411 630163411 106578304 106578304 -850942785 106578304 228018568 228018568 2280…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Pavel's signals Taller Ahead - MEDIUM Coding Problem | CodeTikki