CT48627

Neel's beacons Reckoning

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Neel the log keeper watches over the otter slides of Sleekwater's stores of beacons. A careful computation stands between order and chaos. 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: 1523 292324470 587418173 246725022 -361463237 -953653451 -689954466 -637836137 928361868 -467172140 -140889840 379376802 -790538539 465520232 97027014 828507756 60658929 -425007871 502895816 604739143 597157064 -160181569 -89418429 -54447050 -708253650 236149091 -25879406 329240852 744228586 535264219 -636481743 -173939498 -221521378 738932903 -289720532 914855174 815202989 -859211891 439276067 -943844362 -251816167 -568744939 -741256947 219052875 -877260155 -196980023 517195106 41930745 -581460747 -92315780 537764227 653923270 47618029 -460222941 166613634 -716630765 672383408 894036277 516403087 -105405544 -199446129 930547795 -286508185 -8238186 836009767 733818090 591726894 -607578161 745825798 571052561 504064862 -434648065 928693071 587234192 -851442396 198828367 837990486 646637899 …
Output: 587418173 928361868 928361868 928361868 -689954466 -637836137 928361868 930547795 -140889840 379376802 465520232 465520232 828507756 828507756 914855174 502895816 502895816 604739143 744228586 744228586 -89418429 -54447050 236149091 236149091 329240852 329240852 744228586 914855174 738932903 -173939498 738932903 738932903 914855174 914855174 930547795 894036277 439276067 517195106 -251816167 219052875 219052875 219052875 517195106 -196980023 517195106 537764227 537764227 -92315780 537764227 653923270 672383408 166613634 166613634 672383408 672383408 894036277 930547795 930547795 930547795 930547795 997205427 -8238186 836009767 928693071 745825798 745825798 745825798 928693071 928693071 928693071 928693071 997205427 837990486 198828367 837990486 844629928 844629928 844629928 866644192 26657…

Example 2:

Input: 1397 693877947 -963987036 -29218107 844866252 -694586386 25838597 220095599 845256260 -168245144 -239228314 313418336 -998506991 670324613 -651101348 638597759 -498456959 -147920141 284211453 756280476 425448389 -754280455 953680954 -140538170 339148474 813870153 -304675518 185581122 822786037 886193021 -853183275 145973062 -828941839 -970684560 822083093 490937242 -315770985 -546274147 -768172356 881764287 -814099441 94949199 486928555 -327645314 514750959 -359456538 419893063 -605504177 -344661861 -779458467 -81277859 -327602404 -712589658 19783596 280501089 -640049417 -150030776 -915929341 -455327691 -464517638 -873666137 -367822027 248893923 -493859 -879286039 -581130390 -181123164 115802793 -25822416 926645912 -356998169 628440450 96835694 322781210 377542676 315807561 253597459 46849…
Output: 844866252 -29218107 844866252 845256260 25838597 220095599 845256260 953680954 313418336 313418336 670324613 670324613 756280476 638597759 756280476 -147920141 284211453 756280476 953680954 953680954 953680954 975952830 339148474 813870153 822786037 185581122 822786037 886193021 926645912 145973062 822083093 822083093 822083093 881764287 881764287 881764287 881764287 881764287 926645912 94949199 486928555 514750959 514750959 926645912 419893063 926645912 -344661861 -81277859 -81277859 19783596 19783596 19783596 280501089 926645912 -150030776 248893923 -455327691 -367822027 -367822027 -367822027 248893923 926645912 115802793 -581130390 -181123164 115802793 926645912 926645912 975952830 628440450 632736889 322781210 377542676 468494793 468494793 468494793 472675370 472675370 472675370 472675…

Example 3:

Input: 2657 137514653 -43376296 734176082 -176724858 242672744 -823410298 629810445 599451473 325681296 -982516033 143375397 983610204 996610045 672381518 835693686 96224063 875493487 -617545771 -146772812 -72200870 138395834 515874918 116381574 -604680030 -306128133 -311846182 -96401568 -912934600 341764613 -141496735 -198853678 -548596963 243306026 379922575 47012634 832189093 -762020726 -786541553 -549129094 680238536 636606546 814085084 296586107 443846503 167469952 225801831 372827245 745785613 670336630 754408321 -259052825 -787551303 282698761 -744029570 -895229697 422644299 540545460 66779403 -29543007 717260641 761313358 -662816232 -87919840 -380805478 786679378 883132190 -577951817 300437432 608132541 699673174 725795162 102765592 -144969956 321441890 215124896 -826592266 -266140793 -97…
Output: 734176082 734176082 983610204 242672744 629810445 629810445 983610204 983610204 983610204 143375397 983610204 996610045 998180018 835693686 875493487 875493487 883132190 -146772812 -72200870 138395834 515874918 832189093 341764613 -306128133 -96401568 -96401568 341764613 341764613 379922575 243306026 243306026 243306026 379922575 832189093 832189093 883132190 -549129094 -549129094 680238536 814085084 814085084 883132190 443846503 745785613 225801831 372827245 745785613 754408321 754408321 761313358 282698761 282698761 422644299 422644299 422644299 540545460 717260641 717260641 717260641 761313358 786679378 -87919840 786679378 786679378 883132190 899127662 300437432 608132541 699673174 725795162 899127662 321441890 321441890 899127662 899127662 -266140793 899127662 899127662 916539090 31454…

Constraints:

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

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