CT48551

Darian's Ledger of ledgers

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Before the gates of the archive halls of Scrollkeep close for winter, Darian must finish the ledgers 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: 919 -757543269 671040196 -145570853 172705764 -873532121 -806163050 945898244 -20505423 713110209 -445667259 -571588723 -771603108 41842699 886248587 -476980452 -142855188 103930639 -67776854 307558757 779392812 380249025 -289341725 -129633706 -739059220 -52934912 66259414 309628581 182257336 811874314 -169155179 -244623428 636051577 211163539 725556162 531873389 564156960 -384285889 303529549 -746132363 -40884138 -676632676 795895960 761930444 613986118 944680070 -748091445 -704623743 910352959 -132971011 -54025908 -560698036 75212415 -531399045 -802071616 -182377339 377365270 364973800 854831088 -101993083 -765019209 754371245 631635572 -796456604 -899699912 279052332 477792414 -626394184 -820259720 -788467351 -720070777 990769248 56726373 804811380 -106501251 130126303 661344339 -608187…
Output: 671040196 945898244 172705764 945898244 -806163050 945898244 990769248 713110209 886248587 41842699 41842699 41842699 886248587 944680070 -142855188 103930639 307558757 307558757 779392812 811874314 811874314 -129633706 -52934912 -52934912 66259414 309628581 811874314 811874314 944680070 636051577 636051577 725556162 725556162 795895960 564156960 795895960 303529549 795895960 -40884138 795895960 795895960 944680070 944680070 944680070 990769248 -704623743 910352959 990769248 -54025908 75212415 75212415 377365270 -182377339 -182377339 377365270 854831088 854831088 990769248 754371245 754371245 990769248 990769248 279052332 279052332 477792414 990769248 990769248 -788467351 -720070777 990769248 993581743 804811380 965220044 130126303 661344339 965220044 469238652 965220044 988249054 51473476…

Example 2:

Input: 2019 -107039940 -26072696 -439077576 -89339713 392208303 -427248148 869750806 778905439 239534193 265957437 433264207 588043441 -431173894 345595792 15508112 -139433454 356427602 -77370845 308658126 -191215562 -624503952 -48757352 948397394 -618465618 -363478535 -851935478 42328029 16804541 -384507489 -349462605 619354909 -104695258 -963534733 -270198412 -217186796 -891695371 716972123 -335565072 -36669641 617497868 -989077236 640410205 -460832087 -545821013 725922837 -889712856 851371406 -792087356 630235322 -64301143 -347056682 146984524 794625571 504952742 -794790906 755471861 635352895 570603696 121384838 -542136472 -281262502 -77137625 280256638 -411095207 -831659913 494552342 732572015 88641926 -395729761 -562069871 -984972188 -109902788 -646353347 841750976 -579464360 -384018681 -45…
Output: -26072696 392208303 -89339713 392208303 869750806 869750806 948397394 948397394 265957437 433264207 588043441 948397394 345595792 356427602 356427602 356427602 948397394 308658126 948397394 -48757352 -48757352 948397394 964981849 -363478535 42328029 42328029 619354909 619354909 -349462605 619354909 716972123 716972123 -270198412 -217186796 716972123 716972123 725922837 -36669641 617497868 640410205 640410205 725922837 725922837 725922837 851371406 851371406 897438777 630235322 794625571 146984524 146984524 794625571 841750976 755471861 755471861 841750976 732572015 732572015 280256638 -281262502 -77137625 280256638 494552342 494552342 494552342 732572015 841750976 841750976 -109902788 -109902788 -109902788 841750976 841750976 897438777 -384018681 897438777 -435119285 897438777 964981849 46…

Example 3:

Input: 73 -729028133 -472469704 825116930 994085612 226367350 972203123 829387201 902735350 -388197191 154920876 -304321818 -589478728 147246023 -34724252 -690654353 -632185463 -405479019 40901616 -157359516 730573861 529402262 -560390479 604415073 968739384 998145079 -877036718 231170499 -1754360 -237872771 -725481054 585924103 920648578 17219222 -729432304 344973408 -44217517 -573057558 -202431706 368649720 -508654528 651064390 332167730 -232794450 564324352 938774163 434900806 479525486 911811573 -381805789 595855791 609230776 526715618 940542152 -378809574 766628559 -334859181 40229317 -79858655 -522496165 385258485 -711541832 -46523413 -827782166 -436704424 -76394766 -501258507 571807196 516485259 784444158 -791852282 -594733708 504938808 238316122
Output: -472469704 825116930 994085612 998145079 972203123 998145079 902735350 968739384 154920876 730573861 147246023 147246023 730573861 40901616 -632185463 -405479019 40901616 730573861 730573861 968739384 604415073 604415073 968739384 998145079 -1 231170499 585924103 585924103 585924103 585924103 920648578 938774163 344973408 344973408 368649720 368649720 -202431706 368649720 651064390 651064390 938774163 564324352 564324352 938774163 940542152 479525486 911811573 940542152 595855791 609230776 940542152 940542152 -1 766628559 784444158 40229317 385258485 385258485 385258485 571807196 -46523413 571807196 -436704424 -76394766 571807196 571807196 784444158 784444158 -1 -594733708 504938808 -1 -1

Constraints:

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

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