CT52762

Wistful signals Taller Ahead

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The harbor bell rings at the pine barrens of Needlepoint; Jaya weighs the day's signals manifests and starts the calculations. 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: 3444 -33246524 -528295408 -709068732 -917247886 -41598251 -373507435 791521087 -881372240 -815135148 478515789 365157899 489012861 575760103 393125153 -207176607 -73030240 702214880 -990765417 583818311 -221294770 934885539 -34654515 785439780 -671600460 -520251550 -851774181 792517224 695381716 -256685488 417776875 790184504 -893421586 -541395995 665802054 195184950 -835643367 191319853 738065425 -260182751 -683898532 781821880 954663874 868425946 868652954 885437532 271948481 849596177 -604563270 -159218027 -573080608 247052824 -638077146 691158778 -389130601 840263544 -51474531 -83969343 714063232 -988558732 751367956 543353594 -86339869 -596549550 176917115 257324380 971218915 -867101037 101189414 -144090973 -584651631 947580787 -70312931 -80626567 703487497 -435991547 -791496191 -7365…
Output: 791521087 -41598251 -41598251 -41598251 791521087 791521087 934885539 -815135148 478515789 489012861 489012861 575760103 702214880 702214880 -73030240 702214880 934885539 583818311 934885539 934885539 954663874 785439780 792517224 -520251550 792517224 792517224 954663874 790184504 417776875 790184504 954663874 -541395995 665802054 738065425 738065425 191319853 738065425 781821880 781821880 781821880 954663874 971218915 868652954 885437532 971218915 849596177 971218915 -159218027 247052824 247052824 691158778 691158778 840263544 840263544 971218915 714063232 714063232 751367956 751367956 971218915 971218915 176917115 176917115 257324380 971218915 980677206 101189414 947580787 947580787 947580787 968988321 703487497 703487497 844735033 -73650076 -73650076 609236652 609236652 609236652 844735…

Example 2:

Input: 1726 591582828 133346600 -953259016 854475924 77958216 321829483 707134402 7397961 -350027793 327388008 995340393 -731125396 -77874702 -382980860 -745704250 -241597858 -484299027 282981155 123102640 477441984 -913644869 -997315282 489953790 -573597824 -729915203 -865076072 643095044 -675329892 376206119 346753536 751552442 275305677 -558748871 -812391980 -761921803 182599718 502989866 -744045510 399416836 -71976332 359146989 223325229 -638251390 49370645 -926544539 190828285 170344671 492888952 -607759732 380158488 541160162 -488004355 -73485268 -193816386 69224133 28772580 -549183951 -955328821 460886311 -538130879 480607670 -649685496 -687215861 -670267128 839345004 974612131 628545655 509226035 -350784035 487404657 -424758672 656015742 736336894 631946632 -10410176 939243358 -668456977 …
Output: 854475924 854475924 854475924 995340393 321829483 707134402 995340393 327388008 327388008 995340393 998506498 -77874702 282981155 -241597858 -241597858 282981155 282981155 477441984 477441984 489953790 489953790 489953790 643095044 643095044 643095044 643095044 751552442 376206119 751552442 751552442 839345004 502989866 182599718 -761921803 182599718 502989866 541160162 399416836 492888952 359146989 492888952 492888952 49370645 190828285 190828285 492888952 492888952 541160162 380158488 541160162 839345004 -73485268 69224133 69224133 460886311 460886311 460886311 460886311 480607670 480607670 839345004 839345004 -670267128 839345004 974612131 987536878 656015742 656015742 487404657 656015742 656015742 736336894 939243358 939243358 939243358 966993462 877967210 939111691 966993462 987536878…

Example 3:

Input: 894 387800465 -731962698 808239278 606585843 -272867495 874939755 -587151039 -219598802 -10249297 832329247 -957292589 -539572766 352474352 244334858 -941958419 -190024481 -778059655 112639391 -493518331 755829504 -339799161 -799895799 -708517276 -353604881 -759580712 -957338949 577100524 -851850259 626154786 -430817820 -954672940 -304022257 746244839 65930132 -387371945 -420099468 520968362 -640213006 -632364952 160476255 462324206 795393773 -306707642 178205786 -67791619 -534712413 -142710455 912119943 845115389 -71602084 592199614 299493231 574364909 439512638 -489343831 -157865168 -120817039 -428699782 -747941639 -136356180 -438763421 604306059 298690673 624340477 178932310 715673039 -976549130 -668338396 687555948 -695256914 103833799 849237620 825643661 -12860087 -142738066 -84086073…
Output: 808239278 808239278 874939755 874939755 874939755 912119943 -219598802 -10249297 832329247 912119943 -539572766 352474352 755829504 755829504 -190024481 112639391 112639391 755829504 755829504 795393773 577100524 -708517276 -353604881 577100524 577100524 577100524 626154786 626154786 746244839 -304022257 -304022257 746244839 795393773 520968362 520968362 520968362 795393773 -632364952 160476255 462324206 795393773 912119943 178205786 912119943 912119943 -142710455 912119943 966354907 849237620 592199614 604306059 574364909 604306059 604306059 -157865168 -120817039 604306059 -136356180 -136356180 604306059 604306059 624340477 624340477 715673039 715673039 849237620 -668338396 687555948 849237620 103833799 849237620 966354907 966354907 543612435 543612435 543612435 966354907 140012572 966354…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Wistful signals Taller Ahead - MEDIUM Coding Problem | CodeTikki