CT49579

The Stonehallow Taller Ahead

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

It is audit day at the granite steps of Stonehallow. Lothar spreads the beacons records across the table and picks up a sharp pencil. 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: 1880 -123187850 945794300 -368033547 618739991 -596257650 317089204 -261145642 318791220 173011045 -435230429 -792688438 -354563867 -42651992 255860766 275006334 709188182 -353855025 634164070 -480953179 -937390350 367656122 -273079578 -893603180 -945281685 835535616 886066226 -370324998 472105788 -636410057 791995096 -540876152 921630572 -354940903 -196987849 -618675872 360858752 -474149256 -495426753 32368229 382491370 234503914 -669003518 -264979016 26423122 -446462370 888246564 -7762996 -226723700 777404576 -52000616 898646603 67231199 -272912662 -524554474 -817662768 -43770860 -340423289 -43960390 -606659672 910178382 -653163540 -70488846 135798107 -959630190 -918508586 -511568566 722781716 -462131832 545971447 518400420 672903446 444578904 637772248 592784633 641445570 660132160 1613…
Output: 945794300 976861694 618739991 709188182 317089204 318791220 318791220 709188182 255860766 -354563867 -354563867 -42651992 255860766 275006334 709188182 835535616 634164070 835535616 367656122 367656122 835535616 835535616 835535616 835535616 886066226 921630572 472105788 791995096 791995096 921630572 921630572 939558153 -196987849 360858752 360858752 382491370 32368229 32368229 382491370 888246564 888246564 -264979016 26423122 888246564 888246564 898646603 777404576 777404576 898646603 898646603 910178382 910178382 -43770860 -43770860 -43770860 910178382 -43960390 910178382 910178382 939558153 -70488846 135798107 722781716 -918508586 -511568566 722781716 816954473 545971447 672903446 672903446 816954473 637772248 641445570 641445570 660132160 816954473 816954473 -49245281 49112151 81695447…

Example 2:

Input: 898 -506316175 -663499789 351141042 837056682 -204306509 -488653266 -779327022 -528281288 954754460 -271454095 -803404391 -997050718 50332734 -635025972 -198202454 -787512591 -133996310 -232510854 -395298503 926943449 -36347867 376907257 -909408525 317522472 212613086 213938755 -127518207 308333891 -600330951 858033381 -986371797 528633152 -790335543 -418635062 279744670 -688237521 -891865141 454720493 388856401 339686963 -519910212 425304595 56452018 910456727 740444538 -890745900 124707796 36201517 220460249 503999716 64247209 718179090 -99910244 136221098 -253774484 -777282641 667045090 -491203144 416738440 384563190 -627230458 -256994355 48269256 -149870270 -604156527 458203124 918126714 -789863779 377222396 666830943 999139324 -817798079 62073309 -740466223 595851120 -765159223 736584…
Output: 351141042 351141042 837056682 954754460 954754460 954754460 -528281288 954754460 999139324 50332734 50332734 50332734 926943449 -198202454 -133996310 -133996310 926943449 926943449 926943449 999139324 376907257 858033381 317522472 858033381 213938755 308333891 308333891 858033381 858033381 910456727 528633152 910456727 -418635062 279744670 454720493 454720493 454720493 910456727 425304595 425304595 425304595 910456727 910456727 918126714 918126714 124707796 220460249 220460249 503999716 718179090 718179090 918126714 136221098 667045090 667045090 667045090 918126714 416738440 458203124 458203124 -256994355 48269256 458203124 458203124 458203124 918126714 999139324 377222396 666830943 999139324 -1 62073309 595851120 595851120 736584657 736584657 895020537 931632393 210712025 210712025 701338…

Example 3:

Input: 989 -624549243 494884096 959843946 682413472 -920122802 -812806477 85826045 -698610410 636356090 -84450279 86034206 -593510657 338470678 -504583533 -573203313 -560800580 631773171 350813309 289793193 727520647 -538588806 -839534543 -349630346 5168854 366142841 -865628022 -196172935 502891189 351307957 -751570387 -363930675 716273787 -754522121 354334027 35170325 -979817599 -50308293 -736897163 482680246 -426129304 614143193 -658408033 906176888 909865252 -159852304 17536052 698319342 -310974894 485941969 563476567 930851774 -743772043 187824666 -512857727 552846862 616888138 -388546420 -936841038 30869909 -234228326 -867562535 988335163 676016793 344419708 254156977 -717929087 -279846138 -281571970 -932641158 941464388 -987475847 125670331 323222371 817757110 -258543988 -935249001 1681477 …
Output: 494884096 959843946 988335163 727520647 -812806477 85826045 636356090 636356090 727520647 86034206 338470678 338470678 631773171 631773171 -560800580 631773171 727520647 727520647 727520647 906176888 -349630346 -349630346 5168854 366142841 502891189 -196172935 502891189 716273787 716273787 -363930675 716273787 906176888 354334027 482680246 482680246 -50308293 482680246 482680246 614143193 614143193 906176888 906176888 909865252 930851774 17536052 698319342 930851774 485941969 563476567 930851774 988335163 187824666 552846862 552846862 616888138 988335163 30869909 30869909 988335163 988335163 988335163 992624847 941464388 941464388 941464388 -279846138 941464388 941464388 941464388 953564356 125670331 323222371 817757110 884781117 1681477 1681477 884781117 884781117 931376010 931376010 7092…

Constraints:

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

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