CT36407

Cressida's registers Reckoning

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Cressida found an old ledger of registers in the granary attic at the smokehouses of Brineport. The margin notes pose a precise question. 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: 1015 361304521 217311989 237458836 -995910457 33456523 -621911136 739237682 483973918 -360910242 -77516205 -862750758 -590740795 375682566 900455400 976385473 -6630579 -565014934 997419950 -607805546 -654057425 929643423 365308663 149007174 -65989439 -32622923 754375883 -320523493 -317450650 8327890 -393579754 -298154030 -769186032 138463310 -251828682 -149504534 -54390949 990060895 970047469 -712046496 -696194967 929299183 418511304 -216665992 29872714 -631271618 218710068 505322477 -763585692 -409866553 244163939 -876491797 -956266062 -139700028 351644513 411325586 -419607499 -464562407 -201315255 808071348 110378286 -325902711 -630001171 -582236840 945720394 -593724836 -600261225 -417877265 424461822 509188839 -48950057 -965419033 -872920512 361595476 328809107 -154630053 -876060873 -33…
Output: 739237682 237458836 739237682 33456523 739237682 739237682 900455400 900455400 -77516205 375682566 -590740795 375682566 900455400 976385473 997419950 997419950 997419950 -1 929643423 929643423 990060895 754375883 754375883 -32622923 754375883 990060895 -317450650 8327890 138463310 -298154030 138463310 138463310 990060895 -149504534 -54390949 990060895 992777590 992777590 -696194967 929299183 945720394 505322477 29872714 218710068 218710068 505322477 808071348 -409866553 244163939 351644513 -139700028 -139700028 351644513 411325586 808071348 -201315255 -201315255 808071348 945720394 945720394 945720394 -582236840 945720394 954693325 -417877265 -417877265 424461822 509188839 755802475 361595476 -872920512 361595476 457515424 457515424 46952149 -335271574 -208737689 -208737689 -157195949 -497…

Example 2:

Input: 1245 660822067 660313508 245609175 226241333 530215826 773705138 -798517049 -645084348 -478484759 -734758460 -32507681 -755507643 -346729588 838593033 37420264 880175084 -732983582 378470448 417293835 818491877 -601173337 48218819 -242654105 -841086895 -946629741 -857144346 -934804490 901567139 666494998 -265613599 -59477586 479127958 -873983037 -550694427 61012704 -203806809 -306688604 -475961682 948312396 -259822918 798697009 -848812964 -592058064 -407324414 486333155 937162263 996870367 -176424519 303150423 -660207843 -739737999 -209514622 238467411 -597340253 491945804 -574371018 -288339075 -930134704 -873309048 -928638339 -756174422 417744971 141263239 -83085117 -60002305 -241442395 416653527 -9628815 971321489 -362482053 -975833306 684106858 -223682280 479992678 463169906 -343477008 …
Output: 773705138 773705138 530215826 530215826 773705138 838593033 -645084348 -478484759 -32507681 -32507681 838593033 -346729588 838593033 880175084 880175084 901567139 378470448 417293835 818491877 901567139 48218819 901567139 901567139 901567139 -857144346 901567139 901567139 948312396 948312396 -59477586 479127958 948312396 -550694427 61012704 948312396 948312396 948312396 948312396 996870367 798697009 937162263 -592058064 -407324414 486333155 937162263 996870367 -1 303150423 491945804 -209514622 -209514622 238467411 491945804 491945804 971321489 -288339075 417744971 -873309048 -756174422 -756174422 417744971 971321489 416653527 -60002305 416653527 416653527 971321489 971321489 987211057 684106858 684106858 954611820 479992678 954611820 954611820 158552668 954611820 987211057 474696583 -33436…

Example 3:

Input: 2752 580885381 207741103 495713135 -399064711 -301212571 815748319 364258128 -270189560 -827387077 -33333486 -653085139 -536550912 610003199 -55411654 663968729 -148265542 -652606862 765999670 -690105445 223513389 -836713317 381841436 674339572 588123072 524614561 738084990 672584621 -445832355 587924104 -90101115 -441034639 344645254 585448635 63247104 -759949281 29167950 173168045 -221255907 -550684197 -86187924 -570056235 213222528 644026302 -220968762 107553307 -998566190 403507954 624962441 -665606732 582074558 -674170906 117384421 -355896548 24033770 736209899 -334566735 -698712225 -947700785 735629934 -508987473 254778773 998800884 383208384 516094818 741368964 446301375 417039641 103724168 -445514533 -138658418 552929682 77269694 -779760314 113395228 106911037 416609543 596764740 3…
Output: 815748319 495713135 815748319 -301212571 815748319 998800884 610003199 -33333486 -33333486 610003199 -536550912 610003199 663968729 663968729 765999670 765999670 765999670 998800884 223513389 381841436 381841436 674339572 738084990 738084990 738084990 998800884 736209899 587924104 644026302 344645254 344645254 585448635 644026302 173168045 29167950 173168045 213222528 -86187924 -86187924 213222528 213222528 644026302 736209899 107553307 403507954 403507954 624962441 736209899 582074558 736209899 117384421 736209899 24033770 736209899 998800884 735629934 735629934 735629934 998800884 254778773 998800884 -1 516094818 741368964 774392122 552929682 552929682 552929682 -138658418 552929682 596764740 113395228 113395228 416609543 416609543 596764740 774392122 451804593 451804593 774392122 774392…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Cressida's registers Reckoning - MEDIUM Coding Problem | CodeTikki