CT48283

The Taller Ahead Beneath Glowfen

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Legend says the vault under the lantern district of Glowfen opens only for a perfect tally of marks. Rosa means to find out. 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: 3427 858086395 363452910 -964475825 482942006 -827153384 610346534 -947506275 -341696689 683805054 -672771454 -914313725 -227651273 770289799 579244215 460996782 -830414379 309543289 -497598861 657962035 621019343 -600155635 -109105186 -800728236 -249801197 -471112625 -16855122 351180156 -873283099 899701177 -382645198 236804699 -983494622 -760510965 -44172766 975053876 414752625 -209883977 766343580 821598036 697703838 642240809 -949152650 111660441 988557214 212343314 543846621 477356505 -81821398 -604848114 -145721484 109291947 189385529 -522996811 -965656764 31871834 711672482 114754347 -279217706 275141736 -714087482 -140237831 265824212 306627658 384972334 -429418905 -737367678 -747449648 179770023 632016183 -10222902 -680247427 -294754737 194119188 -674165802 310786525 -742727102 75…
Output: 899701177 482942006 482942006 610346534 610346534 683805054 -341696689 683805054 770289799 -227651273 -227651273 770289799 899701177 657962035 657962035 309543289 657962035 657962035 899701177 899701177 -109105186 -16855122 -249801197 -16855122 -16855122 351180156 899701177 899701177 975053876 236804699 975053876 -760510965 -44172766 975053876 988557214 766343580 766343580 821598036 988557214 988557214 988557214 111660441 988557214 999058407 543846621 711672482 711672482 109291947 -145721484 109291947 189385529 711672482 31871834 31871834 711672482 756020073 275141736 275141736 306627658 -140237831 265824212 306627658 384972334 632016183 179770023 179770023 179770023 632016183 756020073 194119188 -294754737 194119188 310786525 310786525 756020073 756020073 879649680 22430546 420756604 4207…

Example 2:

Input: 1900 -10819911 -971785320 -583582791 94364006 286797962 -91086037 -12668723 414098912 802745336 -274201645 -40233597 521439272 962407449 985024055 -945847572 -683421204 930564047 362396255 174100116 -800549014 518900088 703716315 -472270599 859113890 -513707921 -74330591 -590169406 790888728 -186688848 -585004949 555588951 -261666482 -848162805 252869694 -430954507 833785038 654858577 423070834 -833235138 -977855724 285339436 62543346 -251889387 -244716923 767608554 -266758406 147729305 277719827 -610074257 -151145124 185934326 -855713903 -697052456 -756717712 648869030 504761373 854885155 153962785 -92871165 331742042 405315269 109373651 -180271212 536240507 -614414220 -202838356 -501550825 -653650968 -869352354 -543217244 57903941 432373145 165588718 -302959495 370505651 -728524950 74470…
Output: 94364006 -583582791 94364006 286797962 414098912 -12668723 414098912 802745336 962407449 -40233597 521439272 962407449 985024055 992920829 -683421204 930564047 952579734 518900088 518900088 518900088 703716315 859113890 859113890 952579734 -74330591 790888728 790888728 833785038 555588951 555588951 833785038 252869694 252869694 833785038 833785038 854885155 767608554 767608554 285339436 285339436 767608554 767608554 -244716923 767608554 854885155 147729305 277719827 648869030 -151145124 185934326 648869030 -697052456 648869030 648869030 854885155 854885155 952579734 331742042 331742042 405315269 536240507 536240507 536240507 744709434 -202838356 57903941 57903941 -543217244 -543217244 57903941 432373145 744709434 370505651 370505651 744709434 744709434 952579734 -280674855 547285376 620657…

Example 3:

Input: 2700 555429423 204527052 -866611769 752398040 -324196433 719580694 400510761 24272736 645574195 -2309739 520319914 688808999 924791401 574637928 -661994555 452731919 807840947 572583505 -961802030 804396006 -639640519 156678263 450036501 -295847031 -288731703 646626082 473839509 900591888 737783457 -189667016 799657322 207395916 -769374526 599216687 934288145 293583801 702842026 177219413 406369747 -576144335 257736125 76155463 -767426434 837734807 871024841 55787782 -786451085 -217992908 -482068540 -574117108 -137914216 -362481168 -551225363 -457534136 -9332400 -61004506 -823663827 454510200 -653532179 -416595830 -542877444 -101298798 400083592 829218993 858503298 874374230 -421114987 -640673159 216364064 -59937367 334804686 -679700393 -930190907 390033933 901735157 -263502218 149632253 1…
Output: 752398040 752398040 752398040 924791401 719580694 924791401 645574195 645574195 688808999 520319914 688808999 924791401 934288145 807840947 452731919 807840947 900591888 804396006 804396006 900591888 156678263 450036501 646626082 -288731703 646626082 900591888 900591888 934288145 799657322 799657322 934288145 599216687 599216687 934288145 944655261 702842026 837734807 406369747 837734807 257736125 837734807 837734807 837734807 871024841 874374230 454510200 -217992908 -137914216 -137914216 -137914216 -9332400 -9332400 -457534136 -9332400 454510200 454510200 454510200 829218993 -416595830 -101298798 -101298798 400083592 829218993 858503298 874374230 901735157 216364064 216364064 334804686 334804686 390033933 390033933 390033933 901735157 944655261 149632253 156806291 374061130 799571664 9446…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Taller Ahead Beneath Glowfen - MEDIUM Coding Problem | CodeTikki