CT53535

Mason and the Taller Ahead

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The council of the mulberry rows of Silkmead pays by the answer, and Mason intends to earn it. First: the full register of marks. 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: 635 -57034110 -173502634 968016579 -64015513 -393081572 -275404174 307604571 -560715001 198786497 -84385150 533472337 740778936 -210768348 -307020622 920638203 -35303171 721288055 -167945500 845301039 -519580069 -717805255 700653694 286137809 -282706844 526448977 -7338558 823763169 -306960745 -995275034 709198694 221345291 -411915943 677774930 -489616090 618804158 -768586054 -193363884 964876663 -390039883 149516021 -429133463 -420512443 453287064 -435793727 60629444 -379639713 -376075266 949633954 -584815084 -428013012 -438469496 201074193 -110872337 -826748691 644117724 -179781250 934489720 -522298173 -208128710 832888165 -431501770 -378095426 -536951479 -717452578 -127123325 -610791291 -399169615 -290779528 184938341 -629190088 -586835254 646272552 980557625 -306226090 781670099 -443355…
Output: 968016579 968016579 980557625 307604571 -275404174 307604571 533472337 198786497 533472337 533472337 740778936 920638203 920638203 920638203 964876663 721288055 845301039 845301039 964876663 700653694 700653694 823763169 526448977 526448977 823763169 823763169 964876663 709198694 709198694 964876663 677774930 677774930 964876663 618804158 964876663 -193363884 964876663 980557625 149516021 453287064 -420512443 453287064 949633954 60629444 949633954 -376075266 949633954 980557625 -428013012 201074193 201074193 644117724 644117724 644117724 934489720 934489720 980557625 -208128710 832888165 980557625 -378095426 -127123325 -127123325 -127123325 184938341 -399169615 -290779528 184938341 646272552 -586835254 646272552 980557625 995579033 781670099 920702638 18048306 18048306 720247904 920702638 …

Example 2:

Input: 1227 -145706858 -312567970 840388302 -183834208 628593783 910820511 -671986975 -476857511 -169403670 -815425704 803697014 173868546 -787940394 275500164 217655943 -755929427 -259700999 211078652 390954506 -865914372 -331451655 991708374 751091437 424621387 412328737 160670393 -524988759 910625036 -365663484 942302711 -255851476 280990483 -931073633 -643786992 54059245 -411872333 963560378 -641125358 107300008 133865528 761299148 -786394709 199124682 622352060 542659433 218406421 52293518 591194499 175192413 -578168206 -956041969 352081144 -386469376 296512066 977101104 602251982 766322331 546537980 -888887696 -624559945 751524054 -96063375 629765334 -606699524 -722336260 452754812 -83235108 -306209974 517887443 792052729 401984383 -807773231 399200785 675869873 533666480 -857104143 1670292…
Output: 840388302 840388302 910820511 628593783 910820511 991708374 -476857511 -169403670 803697014 803697014 991708374 275500164 275500164 390954506 390954506 -259700999 211078652 390954506 991708374 -331451655 991708374 992031424 910625036 910625036 910625036 910625036 910625036 942302711 942302711 963560378 280990483 963560378 -643786992 54059245 963560378 963560378 977101104 107300008 133865528 761299148 977101104 199124682 622352060 977101104 591194499 591194499 591194499 977101104 352081144 352081144 352081144 977101104 296512066 977101104 982974140 766322331 792052729 751524054 -624559945 751524054 792052729 629765334 792052729 452754812 452754812 517887443 517887443 517887443 792052729 920938729 675869873 399200785 675869873 760860606 586401480 167029282 586401480 760860606 432733880 76086…

Example 3:

Input: 348 145567363 -899038667 -724987799 204765983 156560976 863123072 640103355 499193059 859128596 504159785 225946107 510561493 -656253200 -590626726 95587431 405254883 -181143294 931249266 -707797663 934644975 451153485 -525619665 142377766 251880787 -525444890 118407555 212958103 -814028968 703711016 312877051 -853797058 78429244 588440691 -574503782 -505114974 339132152 691484408 730627600 818344771 -744441794 197401327 -744529790 985050411 -454313062 93104417 181129460 296748525 -938919717 861771611 488171229 901062519 723736612 -886426280 153190717 -971056362 934096309 568294495 -991354112 -470727787 228265559 603975261 876509008 152832364 578860268 34730653 -611755286 -770291525 185890436 985784972 -314009217 423567614 281891951 961088593 -504067362 -234274412 -12323713 589814343 90275…
Output: 204765983 -724987799 204765983 863123072 863123072 931249266 859128596 859128596 931249266 510561493 510561493 931249266 -590626726 95587431 405254883 931249266 931249266 934644975 934644975 985050411 703711016 142377766 251880787 703711016 118407555 212958103 703711016 703711016 730627600 588440691 78429244 588440691 691484408 -505114974 339132152 691484408 730627600 818344771 985050411 197401327 985050411 985050411 985784972 93104417 181129460 296748525 861771611 861771611 901062519 901062519 934096309 934096309 153190717 934096309 934096309 985784972 603975261 -470727787 228265559 603975261 876509008 985784972 578860268 985784972 185890436 185890436 185890436 985784972 987245084 423567614 961088593 961088593 978849984 -234274412 -12323713 589814343 902751834 937162650 978849984 -1311987…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Mason and the Taller Ahead - MEDIUM Coding Problem | CodeTikki