CT44183

Crystal marks Taller Ahead

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Morning light hits the sulphur springs of Brimstone as Cressida unrolls the day's manifest of marks. The tally will decide the next shipment. 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: 1696 -802436679 -755013383 -449449632 -21396270 872349875 -619004522 -542323718 -283132841 274248992 138707442 -628998629 149743743 -660683092 -260648012 -690656174 166420233 223690579 -476539207 949084484 -115727369 97959212 -963994528 -788973264 -426357507 487724512 178057678 -599087781 -546104688 -285472170 123337478 439110301 -937547835 844975716 -655632047 246763673 -96546415 -212496135 -949667209 -431872502 603440045 -788756002 -607898690 -25392397 -641631944 109129394 395648885 -481274479 258671051 531316644 503056665 596818615 -332647729 810867653 677639899 -13350900 451539338 -726750683 -616988847 -556549017 79649300 101966788 -434091739 874836744 658632981 -403896592 -878973499 -653781057 -989417562 -126689980 316534051 -371475919 222299907 -866153150 -504190881 311791077 1086577…
Output: -755013383 -449449632 -21396270 872349875 949084484 -542323718 -283132841 274248992 949084484 149743743 149743743 166420233 -260648012 166420233 166420233 223690579 949084484 949084484 993708622 97959212 487724512 -788973264 -426357507 487724512 844975716 439110301 -546104688 -285472170 123337478 439110301 844975716 844975716 874836744 246763673 603440045 603440045 603440045 -431872502 603440045 810867653 -607898690 -25392397 109129394 109129394 395648885 531316644 258671051 531316644 596818615 596818615 810867653 810867653 874836744 874836744 451539338 874836744 -616988847 -556549017 79649300 101966788 874836744 874836744 993708622 993708622 -126689980 -653781057 -126689980 -126689980 316534051 395245491 222299907 311791077 -504190881 311791077 395245491 395245491 395245491 993708622 -159…

Example 2:

Input: 2547 493136088 215312095 -663883939 -561937750 99547078 -666339376 -489215131 -811462835 420779183 783203975 924138235 -287356795 -500211858 21548879 616093037 275385634 81445876 735180082 756759521 230493543 831968152 142960518 -628095980 -517628183 -396440606 700075280 851098258 -309301167 -269907098 497675394 -321595699 669137896 -82976519 -709087322 158171471 909500779 -447816355 -32951511 670279372 926092453 -408977658 810776164 -781173649 -987390486 -484820343 281018565 -848392236 654123354 -665082996 233179871 -492080123 -614327412 760859751 755464642 237476062 -430233015 -154453478 501977041 147730584 919223003 -726843819 -49238162 -72247568 133838438 361886052 469044653 -527852299 -326446025 893854108 306488927 136157046 547596421 -537474659 -485318013 -929306821 7785767 -54750847…
Output: 783203975 420779183 -561937750 99547078 420779183 -489215131 420779183 420779183 783203975 924138235 926092453 21548879 21548879 616093037 735180082 735180082 735180082 756759521 831968152 831968152 851098258 700075280 -517628183 -396440606 700075280 851098258 909500779 -269907098 497675394 669137896 669137896 909500779 158171471 158171471 909500779 926092453 -32951511 670279372 926092453 963017142 810776164 919223003 -484820343 -484820343 281018565 654123354 654123354 760859751 233179871 760859751 760859751 760859751 919223003 919223003 501977041 -154453478 501977041 919223003 919223003 963017142 -49238162 133838438 133838438 361886052 469044653 893854108 -326446025 893854108 963017142 547596421 547596421 614694450 -485318013 7785767 7785767 394514523 394514523 614694450 614694450 8744861…

Example 3:

Input: 99 -937795185 -567675014 141198462 301871095 -935636910 -807475556 97299053 650714308 421073635 810511740 -843766997 -460747897 -242439235 -195539342 -472889432 -30074644 738094327 692850587 -941492059 166802713 452881900 2632890 793208639 372378572 -980846333 -632376507 309470077 -129797565 -233572854 -595730448 761598288 -149125545 579659316 582377021 572978581 613365293 961644961 -87096027 652012611 -140838647 -251847997 -126524541 -231416473 664295378 -474116416 821708704 11142726 160593866 9241957 844826771 807221068 512558317 11728926 -182150209 -903277492 -777905620 -665402225 -565338663 924253622 -631711848 -49802900 -248124742 -208805050 -725294988 687446967 186184060 195288028 -323544609 93410818 707832153 -933468847 656367577 605387471 -192290034 753899525 -75984684 743831702 30…
Output: -567675014 141198462 301871095 650714308 -807475556 97299053 650714308 810511740 810511740 961644961 -460747897 -242439235 -195539342 -30074644 -30074644 738094327 793208639 793208639 166802713 452881900 793208639 793208639 961644961 761598288 -632376507 309470077 761598288 761598288 761598288 761598288 961644961 579659316 582377021 613365293 613365293 961644961 -1 652012611 664295378 -126524541 -126524541 664295378 664295378 821708704 821708704 844826771 160593866 844826771 844826771 924253622 924253622 924253622 924253622 924253622 -777905620 -665402225 -565338663 924253622 960919232 -49802900 687446967 -208805050 687446967 687446967 707832153 195288028 707832153 93410818 707832153 753899525 656367577 753899525 753899525 753899525 960919232 743831702 960919232 721952848 721952848 9609192…

Constraints:

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

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