CT36060

The Painted registers of Rhea

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

At the honey farms of Buzzwell, Rhea records each registers in a worn leather ledger. The guild wants answers, not guesses. 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: 2925 942390680 712309867 382108964 -536030066 -722068084 -901250903 609252731 -857610842 -216410063 -175308161 405580808 -346368933 -552693754 804350471 -432568235 -435496663 6601243 -654976580 -570951810 -702643736 -461658507 423727562 -619265774 -486295016 -96876574 -895919422 343825472 883480669 584585060 -464954452 -557959095 -395401246 90674942 -991109563 -1204886 507389854 -94180935 148100143 384803052 129645194 -905804204 919950033 -698000529 -158656420 -993034622 263674976 613738205 -722314559 -482331310 -728798842 -723130911 -683512212 430319102 -31945813 502065853 107575147 -104609505 479568261 -859642102 21560600 417360023 209975716 -202659645 -962900483 -675815207 660482597 -952425455 -952875271 -51449676 -821495882 -753695292 -126130340 -336342406 913238380 -408686473 -6310405…
Output: 969883634 804350471 609252731 609252731 609252731 609252731 804350471 -216410063 -175308161 405580808 804350471 804350471 804350471 883480669 6601243 6601243 423727562 -570951810 -461658507 -461658507 423727562 883480669 -486295016 -96876574 343825472 343825472 883480669 919950033 919950033 -395401246 -395401246 90674942 507389854 -1204886 507389854 919950033 148100143 384803052 919950033 919950033 919950033 932300056 -158656420 263674976 263674976 613738205 660482597 -482331310 430319102 -723130911 -683512212 430319102 502065853 502065853 660482597 479568261 479568261 660482597 21560600 417360023 660482597 660482597 660482597 -675815207 660482597 913238380 -51449676 -51449676 913238380 -753695292 -126130340 913238380 913238380 932300056 65754178 65754178 752696070 850986037 850986037 8595…

Example 2:

Input: 2341 -60429849 924747717 -152753509 -679003308 177375531 204574396 -845775219 60090508 743842946 286277175 256110060 -692231370 819881719 -98021536 674970910 -698135717 791392384 -384782341 530066256 722461751 -418164342 499802713 335254294 -321855805 11411313 255766200 148748449 405054085 207335060 -710318589 690447287 -461009153 51487560 -788395438 972224950 806486238 -944412445 -612704472 -885112097 -451453994 -806850722 157221190 -337023239 800111569 -191479528 -546683042 504944209 494344526 -212366513 627174285 -267153243 323402374 -250238632 -22600009 -821247079 -730085042 414591305 317302580 -535129296 875298669 -21129373 4512084 984196280 598864063 885178855 -248472071 -958064646 180925789 -796383815 652063820 -287445915 743460025 -970750927 83379507 692558742 -979775824 871722864 …
Output: 924747717 972224950 177375531 177375531 204574396 743842946 60090508 743842946 819881719 819881719 819881719 819881719 972224950 674970910 791392384 791392384 972224950 530066256 722461751 972224950 499802713 690447287 405054085 11411313 255766200 405054085 405054085 690447287 690447287 690447287 972224950 51487560 972224950 972224950 984196280 875298669 -612704472 -451453994 -451453994 157221190 157221190 800111569 800111569 875298669 504944209 504944209 627174285 627174285 627174285 875298669 323402374 414591305 -22600009 414591305 -730085042 414591305 875298669 875298669 875298669 984196280 4512084 984196280 990422617 885178855 916459967 180925789 180925789 652063820 652063820 743460025 743460025 871722864 83379507 692558742 871722864 871722864 916459967 -466529205 -135849001 610560057 …

Example 3:

Input: 2672 858712999 -439622506 -274752798 -529630409 211347588 -430950305 96187340 149847977 604079199 892445469 60108688 -357482938 -304426423 -416910909 -753905375 146844930 -878777973 670574365 -942638650 284420685 -946311405 454664998 541339490 904896425 -376794712 106144045 474191955 -525181627 -420447681 226172512 -393227341 -817730540 -267534702 146519346 -805430966 380933041 -123377390 -33028223 -657035684 -251802436 -788342743 -357047139 -854886275 -786816747 -308557537 -52555514 -955342614 -735478019 -302188997 -484784461 246962279 653827825 -655670989 94469802 60761837 730148728 -872088837 -596939617 92424207 507920914 355579760 -614330038 872933079 -86872705 828833008 38655154 221532229 907632144 381663533 -640444862 524222508 -543781561 -147034197 -717843130 963539374 815338476 463…
Output: 892445469 -274752798 211347588 211347588 604079199 96187340 149847977 604079199 892445469 904896425 146844930 -304426423 146844930 146844930 146844930 670574365 670574365 904896425 284420685 454664998 454664998 541339490 904896425 907632144 106144045 474191955 653827825 -420447681 226172512 380933041 -267534702 -267534702 146519346 380933041 380933041 653827825 -33028223 246962279 -251802436 -52555514 -357047139 -308557537 -786816747 -308557537 -52555514 246962279 -735478019 -302188997 246962279 246962279 653827825 730148728 94469802 730148728 730148728 872933079 -596939617 92424207 507920914 872933079 872933079 872933079 907632144 828833008 907632144 221532229 907632144 963539374 524222508 524222508 963539374 -147034197 963539374 963539374 997020187 997020187 632827852 103707310 103707310…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Painted registers of Rhea - MEDIUM Coding Problem | CodeTikki