CT43688

The Scarlet ledgers of Blythe

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Every season at the cotton rows of Whitewick, someone must chart the migration season. This year the task falls to Blythe, armed only with the ledgers register. 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: 3871 -962504083 489690803 856281891 566384530 -37025613 -445453921 -53467731 757202901 205867958 -39786619 -902850268 192642631 -70276080 737109350 -323267078 714012765 91295009 134459255 867312831 -560446953 -233925490 210816901 -59001156 21005794 -584626885 -197484086 166817425 -800019603 574047277 28208817 -309369218 -579482631 -777837529 -867581141 -435158842 949969643 -778365293 96644862 362843946 81309672 -830809482 -82109204 523602477 -826687474 21851974 100390388 -916103556 126751586 -367923512 -170415839 208216043 -390665437 346730996 -707041673 -422391801 -59135827 674566081 -60554679 143269996 9760506 679435112 -368743573 801089131 -942798424 418490783 26485809 -798142888 323672928 -977956493 -865240044 143931931 -182542962 355471937 957938499 50888940 863013178 -148774994 91252…
Output: 489690803 856281891 867312831 757202901 757202901 -53467731 757202901 867312831 737109350 192642631 192642631 737109350 737109350 867312831 714012765 867312831 134459255 867312831 949969643 -233925490 210816901 574047277 21005794 166817425 -197484086 166817425 574047277 574047277 949969643 949969643 949969643 -435158842 -435158842 -435158842 949969643 957938499 96644862 362843946 523602477 523602477 -82109204 523602477 674566081 21851974 100390388 126751586 126751586 208216043 -170415839 208216043 346730996 346730996 674566081 -422391801 -59135827 674566081 679435112 143269996 679435112 679435112 801089131 801089131 957938499 418490783 957938499 323672928 323672928 355471937 -865240044 143931931 355471937 355471937 957938499 991285256 863013178 912525039 912525039 926264466 727042210 73601…

Example 2:

Input: 2558 -815681835 649832476 -304933744 -262120798 449316434 174139228 176474787 238586741 356682598 -971284946 219294167 991590846 -305768923 48470901 461348147 461507034 379846074 -804415390 661636627 -306144754 322186969 -218849107 209296422 96620978 -959321240 679723544 -549826353 -435102165 70074875 455488879 -321775491 -700126380 -788495205 -43739317 -448941311 870969382 24654098 699179496 -825126790 783322468 371356385 969131219 -791822705 635800084 -200129288 497500883 -367614380 579179390 960810730 -746350697 -653967547 577976740 905572466 -693884957 -188346425 128191839 735870761 751175676 -675058547 937073542 -32864560 -129723940 -458357462 -970617688 -955109207 -545580792 621947960 -972773999 -13178649 393641355 -121621066 -872540002 437045120 -111767407 689048747 -814058691 -2642…
Output: 649832476 991590846 -262120798 449316434 991590846 176474787 238586741 356682598 991590846 219294167 991590846 994450776 48470901 461348147 461507034 661636627 661636627 661636627 679723544 322186969 679723544 209296422 679723544 679723544 679723544 870969382 -435102165 70074875 455488879 870969382 -43739317 -43739317 -43739317 870969382 870969382 969131219 699179496 783322468 783322468 969131219 969131219 979117721 635800084 960810730 497500883 579179390 579179390 960810730 979117721 -653967547 577976740 905572466 937073542 -188346425 128191839 735870761 751175676 937073542 937073542 979117721 621947960 621947960 621947960 -955109207 -545580792 621947960 689048747 -13178649 393641355 437045120 437045120 437045120 689048747 689048747 695027127 -264217309 -169364187 -169364187 -169364187 69…

Example 3:

Input: 1611 -943088813 456139445 2331281 171021145 321844477 761903352 -231799212 544550594 475235378 392061011 -926650548 -966294496 218532983 676492895 -65005206 228164239 246535767 -81203011 -38314979 417964406 -722682646 946093080 -301555886 716363151 56044493 -143285399 146730324 -353771016 -181791712 -591343228 149110266 98973785 95559195 -960156470 667476458 44523955 -431041101 427309342 -78540988 -338991556 -947191482 -912488904 -557339411 -445773036 794908671 833118419 -234140480 748264837 554756509 833554283 -492253713 -564402898 706987151 654600809 730984084 575974569 -477282644 -603258952 -712090412 -813308260 334234089 72567380 -522903998 27464832 962584946 304471334 -237379447 936188899 -91242944 -770560098 -478699222 33170481 605155825 692084110 -621647232 789270649 -908836326 -616…
Output: 456139445 761903352 171021145 321844477 761903352 946093080 544550594 676492895 676492895 676492895 218532983 218532983 676492895 946093080 228164239 246535767 417964406 -38314979 417964406 946093080 946093080 962584946 716363151 794908671 146730324 146730324 149110266 -181791712 149110266 149110266 667476458 667476458 667476458 667476458 794908671 427309342 427309342 794908671 794908671 794908671 -912488904 -557339411 -445773036 794908671 833118419 833554283 748264837 833554283 833554283 962584946 706987151 706987151 730984084 730984084 962584946 962584946 334234089 334234089 334234089 334234089 962584946 962584946 27464832 962584946 970423650 936188899 936188899 970423650 33170481 -478699222 33170481 605155825 692084110 789270649 789270649 856731449 -616995529 220932254 422864174 8567314…

Constraints:

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

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