CT46796

The Taller Ahead of Fungaldeep

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Before the gates of the mushroom groves of Fungaldeep close for winter, Yami must finish the marks ledger - one figure at a time. 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: 2230 -594717329 201131730 -927541561 -526017130 -939305565 -191174479 701812312 -235696157 -440800532 200834524 -144348579 885539784 -592790073 -472162468 -878286086 548054015 -615376853 -399599478 -380113406 120030301 597863259 253907630 83570051 308555778 -81208654 487574363 -679264440 -155413513 -588919985 445911421 -333208047 550558877 -552909570 -545998224 278260068 -331234844 -936189443 -383727297 -235417652 -262224323 -986075401 -147659170 126200367 492662350 -201732586 253772092 -109352381 817496766 -797083219 218491766 -578133409 271124258 -706693585 907018427 -523403825 -112635782 346917618 -996242514 490646953 497701439 -117464149 494873453 -563746377 902590861 767457134 -102361696 271516859 -63410666 -839530464 720656125 99888235 -502085215 40037920 -964165963 -986996356 -54301…
Output: 201131730 701812312 -526017130 -191174479 -191174479 701812312 885539784 200834524 200834524 885539784 885539784 907018427 -472162468 548054015 548054015 597863259 -399599478 -380113406 120030301 597863259 817496766 308555778 308555778 487574363 487574363 550558877 -155413513 445911421 445911421 550558877 550558877 817496766 -545998224 278260068 492662350 -235417652 -383727297 -235417652 -147659170 -147659170 -147659170 126200367 492662350 817496766 253772092 817496766 817496766 907018427 218491766 271124258 271124258 907018427 907018427 912258657 -112635782 346917618 490646953 490646953 497701439 902590861 494873453 902590861 902590861 912258657 834311881 271516859 720656125 720656125 720656125 834311881 834311881 40037920 834311881 -543014425 -543014425 834311881 912258657 -170392374 -17…

Example 2:

Input: 2528 -988950151 -290114376 492263845 -525116472 -212690015 -20910146 986359047 -960725572 1842040 220652530 151340197 810678902 698999300 -51434352 -348832535 542542187 508599109 -555510836 -914452949 -807392442 -298913551 -749941186 -60718789 878132211 -817690126 -79710774 354383814 -247213549 803272368 -288348037 172700405 -5551059 861329468 -211208335 -952610900 778109398 -573053745 615652608 920364203 282370417 162697521 -478040935 -386935901 766892597 -260999339 -98047593 -251408622 -495567242 -535340147 -589396710 -634428097 -287708417 -609245208 -533121961 -915355788 -603316325 379621515 719810814 -268626593 151518291 -774392128 450280990 -914837943 -404738401 504643556 -154166904 551359211 -476316728 381991658 831321724 -315749259 198023294 -460909970 849669339 -225230556 -48908991…
Output: -290114376 492263845 986359047 -212690015 -20910146 986359047 992280124 1842040 220652530 810678902 810678902 878132211 878132211 542542187 542542187 878132211 878132211 -298913551 -807392442 -298913551 -60718789 -60718789 878132211 920364203 -79710774 354383814 803272368 803272368 861329468 172700405 861329468 861329468 920364203 778109398 778109398 920364203 615652608 920364203 992280124 766892597 766892597 -386935901 766892597 831321724 -98047593 379621515 379621515 -287708417 -287708417 -287708417 -287708417 379621515 -533121961 379621515 -603316325 379621515 719810814 831321724 151518291 450280990 450280990 504643556 -404738401 504643556 551359211 551359211 831321724 381991658 831321724 849669339 198023294 849669339 849669339 992280124 992280124 -292689336 -292689336 992280124 9972431…

Example 3:

Input: 2904 216754713 382763374 -294899865 -925582575 98524115 -273913970 -924860347 -812060428 -629767434 850209460 572123163 -312281971 -306787425 609378098 -534790644 -859169545 269644399 89412094 162544929 525498634 54994885 687973581 937755804 -204842379 772678119 -997644749 406764366 -287986720 -619130967 -231644966 880966585 -431014561 425921502 -528696863 -503621377 840217115 -171603118 163974476 -38066521 586761370 377892008 -633482528 -742844410 -633608051 -833194319 609774420 -378744880 888217361 854107633 196230578 -915158680 751604115 -501363393 -717416981 -31772040 833536145 107889946 853346612 -252259671 747813987 -282300944 -950546513 -591496543 -774985689 882673423 -135997784 209783953 793209060 115498058 -967934556 -497059852 -31225575 -417813655 827276009 -339199442 662373502 -…
Output: 382763374 850209460 98524115 98524115 850209460 850209460 -812060428 -629767434 850209460 937755804 609378098 -306787425 609378098 687973581 269644399 269644399 525498634 162544929 525498634 687973581 687973581 937755804 993576097 772678119 880966585 406764366 880966585 -231644966 -231644966 880966585 888217361 425921502 840217115 -503621377 840217115 888217361 163974476 586761370 586761370 609774420 609774420 609774420 -633608051 609774420 609774420 888217361 888217361 922046898 882673423 751604115 751604115 833536145 -31772040 -31772040 833536145 853346612 853346612 882673423 747813987 882673423 882673423 -591496543 882673423 882673423 922046898 209783953 793209060 827276009 827276009 -497059852 -31225575 827276009 827276009 831739878 662373502 671148840 -150674801 671148840 818995057 81…

Constraints:

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

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