CT39700

Morgana's Wild Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

It is audit day at the indigo vats of Bluehollow. Morgana spreads the ledgers 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: 2064 -190558162 899988787 -960993478 -377304086 -793037110 -750204795 482258271 164361525 288983272 -217118227 462715969 -358269945 700845196 -735592250 903345407 -860179725 -15839978 644071043 -50045635 -508572486 -763531933 -160013812 -872537004 728157410 -849802428 -529512698 113859203 796904046 -631016438 176298952 875582641 644070845 354475983 555782542 174627674 48217188 738087744 -888623247 -806925240 -348800984 723283520 952461689 134091283 -283237185 556655359 764759274 -320556660 810925948 49992866 -610405882 488277286 792378498 -86736196 143931313 -711449202 -959684326 -804787356 -245106901 571355106 327827481 90157913 415657057 -578609128 -395113274 -115899971 -513017357 35970441 -426225196 530669929 -418828505 -210117938 -44088312 -616151605 20909102 -344889826 705214873 -2745…
Output: 899988787 903345407 -377304086 482258271 -750204795 482258271 700845196 288983272 462715969 462715969 700845196 700845196 903345407 903345407 952461689 -15839978 644071043 728157410 728157410 -160013812 -160013812 728157410 728157410 796904046 -529512698 113859203 796904046 875582641 176298952 875582641 952461689 738087744 555782542 738087744 738087744 738087744 952461689 -806925240 -348800984 723283520 952461689 995158082 556655359 556655359 764759274 810925948 810925948 861192404 488277286 488277286 792378498 861192404 143931313 571355106 -245106901 -804787356 -245106901 571355106 705214873 415657057 415657057 530669929 -395113274 -115899971 35970441 35970441 530669929 530669929 705214873 -210117938 -44088312 20909102 20909102 705214873 705214873 861192404 630973343 861192404 305938652 8…

Example 2:

Input: 1774 -168481258 501710112 7928492 732261957 -703976783 -861514269 32325671 -48214287 -583529247 -874851511 933006323 237353697 707628259 169617163 901804388 467053183 -397244674 -818775874 -690335848 -529711307 -464851169 -286930754 -743750911 -7344046 -295568217 -805556843 -111958649 107825635 -682189724 866736103 -97157028 359448399 -567274784 617301280 443599728 920608839 -392428197 864794122 833878904 997392702 596576667 699447388 -933563474 -644761589 -53185116 313516877 860477042 682107581 -279433973 -258992345 568939063 -176642925 -310300145 945978624 -433885227 -310848522 399174324 -610858112 -145504749 -137310830 227933854 691331963 611262966 -421904566 648867922 225320521 976012796 -786013969 453575869 685867327 -743771415 -449030900 -657080282 632827551 462488687 862999750 -2606…
Output: 501710112 732261957 732261957 933006323 32325671 32325671 933006323 933006323 933006323 933006323 997392702 707628259 901804388 901804388 920608839 866736103 -286930754 -690335848 -529711307 -464851169 -286930754 -7344046 -7344046 107825635 -111958649 -111958649 107825635 866736103 866736103 920608839 359448399 617301280 617301280 920608839 920608839 997392702 864794122 997392702 997392702 998367601 699447388 860477042 -644761589 -53185116 313516877 860477042 945978624 945978624 -258992345 568939063 945978624 945978624 945978624 976012796 -310848522 399174324 691331963 -145504749 -137310830 227933854 691331963 976012796 648867922 648867922 976012796 976012796 987277061 453575869 685867327 862999750 -449030900 632827551 632827551 862999750 862999750 987277061 142022017 142022017 272149906 7…

Example 3:

Input: 971 -886292384 618311611 255825531 689572316 -578955271 -551728505 -13401169 844627089 140202629 -757329070 724212349 790738601 348709571 429341880 774703930 -428078224 488562398 892540816 321460770 451862382 -835898799 -975887686 670751819 -274330803 -890387251 342704700 828253542 -419788016 -370753981 731159466 -210146268 -389422037 -551967138 -367367880 -255368653 -131077332 124145142 541817236 840228629 -359260361 670378317 593232766 551405249 -396822389 -414230266 33980546 333127391 385545913 749896702 807773175 -760630251 858209447 -209384255 365930811 -522323091 549599635 -481418977 28852881 -5090048 -82737357 218979039 64747143 123609949 -935972889 -10452219 -15620288 -161749969 -203276613 646369135 886425328 -339738214 -548269248 590903967 699482828 -359754800 -885759395 321154062…
Output: 618311611 689572316 689572316 844627089 -551728505 -13401169 844627089 892540816 724212349 724212349 790738601 892540816 429341880 774703930 892540816 488562398 892540816 941094739 451862382 670751819 670751819 670751819 828253542 342704700 342704700 828253542 840228629 -370753981 731159466 840228629 -131077332 -367367880 -367367880 -255368653 -131077332 124145142 541817236 840228629 858209447 670378317 749896702 749896702 749896702 33980546 33980546 333127391 385545913 749896702 807773175 858209447 858209447 886425328 365930811 549599635 549599635 646369135 28852881 218979039 218979039 218979039 646369135 123609949 646369135 -10452219 646369135 646369135 646369135 646369135 886425328 941094739 590903967 590903967 699482828 832377247 321154062 321154062 424462764 -230844698 90495851 424462…

Constraints:

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

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