CT44394

Darian and the Crimson registers

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Darian inherited the shed at the copper works of Verdigris along with its curious bookkeeping system for registers. Time to make sense of it. 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: 3224 562485303 359818778 -936070243 -797788939 626538495 -62879857 -999086344 705551965 715817947 834403762 223511398 -441346094 429708239 -182408823 -660134347 232962866 803875548 683768492 -67829771 846497346 -508636751 -960176544 320547896 597408762 63440667 -709763242 495389868 -207746611 865872143 -678117191 -331356124 -273495264 738926949 689168577 -72946087 -800125576 -406823528 514080497 73633576 -681070689 31994870 677657058 -216360761 480322698 892252618 944750539 132429434 765988537 -421668029 556754239 -67487317 -352959071 -677648444 -259012232 -502888767 431297993 -509144021 782475534 693963230 -768278272 -430967718 131347747 -66522355 -399825996 689103298 -581413552 -734310493 929355363 704311380 -964865037 14628193 -387348031 699380523 56878467 14244782 -658998893 -951378222…
Output: 626538495 626538495 -797788939 626538495 705551965 705551965 705551965 715817947 834403762 846497346 429708239 429708239 803875548 232962866 232962866 803875548 846497346 846497346 846497346 865872143 320547896 320547896 597408762 865872143 495389868 495389868 865872143 865872143 892252618 -331356124 -273495264 738926949 892252618 892252618 514080497 -406823528 514080497 677657058 677657058 31994870 677657058 892252618 480322698 892252618 944750539 963995944 765988537 782475534 556754239 782475534 431297993 -259012232 -259012232 431297993 431297993 782475534 782475534 929355363 929355363 -430967718 131347747 689103298 689103298 689103298 929355363 929355363 929355363 963995944 920924435 14628193 699380523 699380523 920924435 129182194 129182194 7375756 -825310615 7375756 129182194 92092443…

Example 2:

Input: 2589 509827589 926387769 -733646326 796096735 -719432557 -421617826 -654196517 -134851638 40659473 901917998 162756009 -897112744 -704410721 29192716 -987645249 -499372741 485726679 135956378 814033191 26689096 -715471764 763408512 488928787 855410197 381280102 -107960790 -627559490 619622563 -818146426 -437594773 -129193045 287664608 786224824 -536785313 -992483228 -783817774 179140422 -898432425 -556544894 404487896 -786938036 259112508 -360993134 705600938 -12809925 -174489168 -816359790 -459477244 -22697933 3718871 266347602 -257773896 -267624790 -648656117 906527201 -956315552 -309506009 -892224016 -420074133 986599063 -348000127 -867093011 928130860 -244157724 -557404551 57625671 259408386 905370236 -810594582 424315144 231761905 -648413535 -772281685 -117848539 304709415 -592762416 …
Output: 926387769 986599063 796096735 901917998 -421617826 -134851638 -134851638 40659473 901917998 906527201 485726679 -704410721 29192716 485726679 -499372741 485726679 814033191 814033191 855410197 763408512 763408512 855410197 855410197 906527201 619622563 619622563 619622563 786224824 -437594773 -129193045 287664608 786224824 906527201 179140422 -783817774 179140422 404487896 -556544894 404487896 705600938 259112508 705600938 705600938 906527201 3718871 -22697933 -459477244 -22697933 3718871 266347602 906527201 906527201 906527201 906527201 986599063 -309506009 986599063 -420074133 986599063 995649441 928130860 928130860 933781360 57625671 57625671 259408386 905370236 933781360 424315144 464472055 304709415 -117848539 -117848539 304709415 464472055 265533729 464472055 627896816 627896816 8610…

Example 3:

Input: 932 -536589724 -683444250 167192544 981497333 937530479 -573991266 -116748185 -601407129 -336894747 -184386840 477831649 -238793759 -634060670 140096541 300092622 551153908 995898179 915731482 385227478 197532628 616699039 407220370 777411497 577406775 378259033 -598955025 852705465 -870814915 -887750664 485080133 9017823 -260295979 991288040 532969654 187718303 -344557902 -975080081 569219814 126040888 -74533725 -443732658 -81907410 406037573 471623746 545161829 947191268 955073069 194531345 -860915665 473236161 -716121304 58704799 585902330 168683189 -765348216 -223636830 940499040 -971994239 699456579 891381179 349438685 -475770428 -916207123 -429866646 999184613 -448882532 -392915344 -726112993 -83754389 -703007326 551851609 -446618842 41548722 -312575245 -897406530 130285616 471861192…
Output: 167192544 167192544 981497333 995898179 995898179 -116748185 477831649 -336894747 -184386840 477831649 551153908 140096541 140096541 300092622 551153908 995898179 999184613 991288040 616699039 616699039 777411497 777411497 852705465 852705465 852705465 852705465 991288040 485080133 485080133 991288040 991288040 991288040 999184613 569219814 569219814 569219814 569219814 947191268 406037573 406037573 -81907410 406037573 471623746 545161829 947191268 955073069 999184613 473236161 473236161 585902330 58704799 585902330 940499040 940499040 -223636830 940499040 999184613 699456579 891381179 999184613 999184613 -429866646 -429866646 999184613 999498558 -392915344 -83754389 -83754389 551851609 551851609 965834230 41548722 130285616 130285616 130285616 471861192 965834230 965834230 980230433 21591…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Darian and the Crimson registers - MEDIUM Coding Problem | CodeTikki