CT41448

Dino and the Taller Ahead

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

It is audit day at the moonlit lagoon of Selene. Dino spreads the registers records across the table and picks up a sharp pencil. 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: 2825 -878675413 -207535910 -989325918 861862284 313818114 -375856858 978117139 -945412018 -535585866 -88259175 -187708504 386312507 -197441408 -850018467 -53507707 107102630 -230131988 -462110125 -130541577 -622466670 -769122925 -205315786 153717311 -44571760 506652878 -992180092 236037360 -747144388 -453100297 -55507188 -979205085 -171595305 375886088 339969485 -118297730 876394346 -596011763 -374315288 499838240 -725936811 -693356534 -999061306 -954144906 -663871953 -75698547 119452780 -831774471 -753764564 464838973 -99191401 -288763424 -498843435 -571966289 -580204977 -19071892 617258133 -371086827 590553267 492081226 -177743124 241401009 370415070 696934642 756370196 63676918 -263971221 -447097125 94189572 190075937 249528658 208057484 565249623 -896665355 925660220 466943087 -2809360…
Output: -207535910 861862284 861862284 978117139 978117139 978117139 989496459 -535585866 -88259175 386312507 386312507 506652878 -53507707 -53507707 107102630 153717311 -130541577 -130541577 153717311 -205315786 -205315786 153717311 506652878 506652878 876394346 236037360 375886088 -453100297 -55507188 375886088 -171595305 375886088 876394346 876394346 876394346 925660220 -374315288 499838240 617258133 -693356534 -663871953 -954144906 -663871953 -75698547 119452780 464838973 -753764564 464838973 617258133 -19071892 -19071892 -19071892 -19071892 -19071892 617258133 696934642 590553267 696934642 696934642 241401009 370415070 696934642 756370196 925660220 94189572 94189572 94189572 190075937 249528658 565249623 565249623 925660220 925660220 977153611 636175298 -244647798 -244647798 636175298 6361752…

Example 2:

Input: 2872 -863817345 739466486 505159220 151934777 -813276582 -314465787 -464588636 -942181165 -27667803 -971112145 40499884 -394265333 -482774649 -52265187 490608382 -318039906 245648777 83065642 384229875 4331368 341206625 -446413288 59927897 -543842318 -376893446 48617808 743495931 843791284 24885534 -639054562 -428051066 315343400 -624639887 564960937 -803446928 720770546 -741056593 -586827831 65883536 -570569679 -247459189 -460791686 -657817819 -356208913 222411211 -770257560 823356268 296101903 -210364261 -48515936 55440766 452528902 -668265387 -376153374 76777948 -106664281 -228448808 129359120 627892632 -794132686 -127261557 621923713 -829775087 -91504972 -116544210 496171311 -907100604 324125238 584904467 171837512 600350166 730880189 -381148602 -142486024 543893257 127045368 -86228536…
Output: 739466486 743495931 743495931 490608382 -314465787 -27667803 -27667803 -27667803 40499884 40499884 490608382 -52265187 -52265187 490608382 743495931 245648777 384229875 384229875 743495931 341206625 743495931 59927897 743495931 -376893446 48617808 743495931 843791284 964866729 315343400 -428051066 315343400 564960937 564960937 720770546 720770546 823356268 -586827831 65883536 222411211 -247459189 222411211 -356208913 -356208913 222411211 823356268 823356268 964866729 452528902 -48515936 55440766 452528902 627892632 -376153374 76777948 129359120 129359120 129359120 627892632 730880189 -127261557 621923713 730880189 -91504972 496171311 496171311 584904467 324125238 584904467 600350166 600350166 730880189 964866729 -142486024 543893257 654702521 654702521 114856961 654702521 91088931 91088931…

Example 3:

Input: 2469 925519122 -528355537 -68814940 -532269048 -714019495 -986273474 -55063275 -403881289 139100140 -585982594 -584351148 63625943 -909103768 977797512 -402447462 -679297393 -855297736 220201161 603701115 -212023481 -241827884 -620206265 40662689 -737046089 858521626 -256253257 -259954448 135072842 936470914 -896398796 361748975 -235748580 -150966105 826880497 572306712 357899880 -322560026 14634625 -108072296 409299695 -684390075 144091704 -149364359 790402633 -922718903 766748040 704345541 952089227 763863377 -984344974 189867091 82141275 435853980 -423028143 616144136 334966476 264591943 -76060513 583370921 -658677076 -607548472 769369234 -475361536 -790938822 -10019584 -956509006 -93981029 879732785 667998330 160030919 49003571 -168738784 -955400733 -743038728 61388063 -717347992 69187…
Output: 977797512 -68814940 -55063275 -55063275 -55063275 -55063275 139100140 139100140 977797512 -584351148 63625943 977797512 977797512 991697219 220201161 220201161 220201161 603701115 858521626 40662689 40662689 40662689 858521626 858521626 936470914 135072842 135072842 936470914 952089227 361748975 826880497 -150966105 826880497 952089227 790402633 409299695 14634625 409299695 409299695 790402633 144091704 790402633 790402633 952089227 766748040 952089227 952089227 991697219 769369234 189867091 435853980 435853980 616144136 616144136 769369234 583370921 583370921 583370921 769369234 -607548472 769369234 879732785 -10019584 -10019584 879732785 -93981029 879732785 991697219 691871146 691871146 61388063 61388063 -743038728 61388063 691871146 691871146 991697219 991697219 991697219 995425012 4802…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.