CT47154

The Taller Ahead of Saprun

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The harbor bell rings at the maple sugarbush of Saprun; Ivo weighs the day's beacons manifests and starts the calculations. 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: 1200 513549385 946662229 -371172275 -130517001 354845093 953987864 -985036276 -58111838 362140789 -430044953 -383704849 -682430705 18435359 -605873353 -755659015 132493007 614731280 -320453765 -219915254 -901570200 386588694 -298248705 240177372 938167117 -712326912 -507909660 -349692794 902774728 -74126090 150643183 -153139050 -857054545 -71249333 -105701188 -803477417 -204231968 67818376 -290071201 928179793 706327222 912560433 -684798434 96412882 -76537963 -479260867 700459703 295119791 475846798 841752655 956063044 174718275 820870534 962811472 -814467478 -333997132 -853229281 232052769 -72704381 -24932784 574468180 -327638713 -811825872 -699660119 789969386 -762354891 772560996 -418377746 183115180 -246355279 -695776483 43000972 -506029058 -995326314 -783784286 123751272 589811539 -79…
Output: 946662229 953987864 -130517001 354845093 953987864 956063044 -58111838 362140789 614731280 -383704849 18435359 18435359 132493007 132493007 132493007 614731280 938167117 -219915254 386588694 386588694 938167117 240177372 938167117 956063044 -507909660 -349692794 902774728 928179793 150643183 928179793 -71249333 -71249333 67818376 67818376 -204231968 67818376 928179793 928179793 956063044 912560433 956063044 96412882 700459703 700459703 700459703 841752655 475846798 841752655 956063044 962811472 820870534 962811472 978646338 -333997132 232052769 232052769 574468180 -24932784 574468180 789969386 789969386 -699660119 789969386 838614645 772560996 784405575 183115180 589811539 43000972 43000972 123751272 123751272 -783784286 123751272 589811539 784405575 -197743023 401300163 784405575 83861464…

Example 2:

Input: 3253 -550520613 -838578681 -785191695 -306050852 -660893065 -326974274 -902831012 -801251265 944505620 -572339278 -898429537 -638687291 308039045 386805117 617194380 -297036804 309194308 379151545 3434351 201085897 -575958565 -764316664 192617009 804620960 -749650197 -959151162 940277963 58941769 -798818939 -17999489 168385683 -728392012 -109447808 879154924 306785038 -371907923 883532254 -983255454 -404066194 -587523959 557645462 45502741 496094387 605769775 -919526916 888780384 401089946 303985126 374267268 -553941030 453762871 -973504131 -973160766 72420214 743223407 311134103 -510538049 268561832 443621417 -486883476 304260618 36325165 41377495 22754313 -464752027 -65618700 -334150099 689587902 -720964057 73660411 -745272027 -857619623 -609038270 978348728 575063178 747463322 415968265…
Output: -306050852 -785191695 -306050852 944505620 -326974274 944505620 -801251265 944505620 978348728 308039045 -638687291 308039045 386805117 617194380 804620960 309194308 379151545 804620960 201085897 804620960 192617009 192617009 804620960 940277963 940277963 940277963 978348728 168385683 -17999489 168385683 879154924 -109447808 879154924 883532254 883532254 883532254 888780384 -404066194 557645462 557645462 605769775 496094387 605769775 888780384 888780384 978348728 453762871 374267268 453762871 453762871 743223407 -973160766 72420214 743223407 978348728 443621417 268561832 443621417 689587902 304260618 689587902 41377495 689587902 689587902 -65618700 689587902 689587902 978348728 73660411 978348728 -609038270 -609038270 978348728 987094029 747463322 987094029 484161572 987094029 104212675 36…

Example 3:

Input: 3844 -568552487 634867065 941252953 668352223 963578450 -744454033 405799987 -191588476 749384790 805297043 -517119106 415196672 357309094 681966036 -261455001 -488063451 431979381 -738365206 -36103014 207899627 -342597263 -391968248 -419322884 327553791 -255952684 518996096 155706507 778788608 -441071961 554341323 -864298941 339960583 -821919445 -335372634 -53759114 -47079657 957104928 872466917 -304383660 68412550 -313136960 958642456 39919142 -354636122 -308235720 109139852 693008007 569232528 -936027047 -32067077 -147799339 438329604 310646578 752380344 -69101442 -921893505 102347499 425370639 587426090 758038641 -902538800 60894355 119582165 740173722 648739153 584124586 -683779645 -360103431 -589813507 -442529685 -680078401 106350506 181021024 -403161642 -831505225 -893298258 -218211…
Output: 634867065 941252953 963578450 963578450 985451968 405799987 749384790 749384790 805297043 957104928 415196672 681966036 681966036 778788608 431979381 431979381 518996096 -36103014 207899627 327553791 327553791 327553791 327553791 518996096 518996096 778788608 778788608 957104928 554341323 957104928 339960583 957104928 -335372634 -53759114 -47079657 957104928 958642456 958642456 68412550 958642456 958642456 985451968 109139852 -308235720 109139852 693008007 752380344 752380344 -32067077 438329604 438329604 752380344 752380344 758038641 102347499 102347499 425370639 587426090 758038641 888941950 60894355 119582165 740173722 744231826 744231826 744231826 -360103431 106350506 -442529685 106350506 106350506 181021024 465589515 -218211097 -218211097 -218211097 38920393 465589515 -649259342 46558…

Constraints:

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

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