CT56092

Brewer's Sunlit Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Before the gates of the island market of Coralcove close for winter, Brewer must finish the beacons 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: 3100 26836537 536493346 760476513 -662885294 13306700 574631575 -423779127 -415909123 748802980 -262694179 -437575944 25709839 -181489458 756669402 -866842002 594323558 300545478 67053684 213430874 -241196268 84591286 371008294 -164859034 97738561 928358162 296448014 827443632 804222303 340355253 -785452737 169099620 570202884 -860006593 764248991 -653168436 -657774931 422687336 -588813368 647101233 -318615345 -43163980 867699754 -384566908 -58558135 -809724924 -261247398 981408525 97896430 -814904898 266142435 806350157 468225994 -595980185 407021573 -124586398 868073504 -504023302 -873476050 -51555497 -409960539 -23135180 -227304537 -928215700 -37693903 -150907124 283958203 482324866 431432968 61264199 979355011 25309279 144703233 331869669 589244836 -78119356 -685658582 -163725883 29128…
Output: 536493346 760476513 928358162 13306700 574631575 748802980 -415909123 748802980 756669402 25709839 25709839 756669402 756669402 928358162 594323558 928358162 371008294 213430874 371008294 84591286 371008294 928358162 97738561 928358162 981408525 827443632 867699754 867699754 570202884 169099620 570202884 764248991 764248991 867699754 422687336 422687336 647101233 647101233 867699754 -43163980 867699754 981408525 -58558135 981408525 -261247398 981408525 997031462 266142435 266142435 806350157 868073504 868073504 407021573 868073504 868073504 979355011 -51555497 -51555497 -23135180 -23135180 283958203 -37693903 -37693903 283958203 283958203 482324866 979355011 979355011 979355011 997031462 144703233 331869669 589244836 933540351 29128971 -163725883 29128971 933540351 941583104 -738822063 -21…

Example 2:

Input: 628 -97242819 -765718784 -847431196 755137994 860771319 759285711 550003741 827027462 -193009581 960512348 550401136 894069828 641311430 380383578 -139785429 -995480067 -410015620 -598683867 -924597907 -583785472 442923779 -528834685 805485826 -458983155 153253008 -984745224 59280552 864069026 -128808493 833432898 737522545 -388429044 249595191 -433231376 72490698 -969939952 716891878 -600491604 -775204383 -72566363 882496191 -96781176 -366630504 619816131 505735489 595286755 -636898271 -73051812 -423883429 -218284949 -248605032 305362461 -513472230 708827877 381615952 -958067547 -668149755 67216866 130799679 -289745185 628963527 -376688809 903678319 -881877198 936983759 -635276828 -563037355 -790846868 294961693 197654997 147939364 -750009742 622986124 -632406361 851053782 -817222318 5103…
Output: 755137994 755137994 755137994 860771319 960512348 827027462 827027462 960512348 960512348 994997958 894069828 903678319 805485826 442923779 442923779 -410015620 442923779 -583785472 -583785472 442923779 805485826 805485826 864069026 153253008 864069026 59280552 864069026 882496191 833432898 882496191 882496191 249595191 716891878 72490698 716891878 716891878 882496191 -72566363 -72566363 882496191 903678319 619816131 619816131 708827877 595286755 708827877 -73051812 305362461 -218284949 305362461 305362461 708827877 708827877 903678319 628963527 -668149755 67216866 130799679 628963527 628963527 903678319 903678319 936983759 936983759 994997958 -563037355 294961693 294961693 622986124 622986124 622986124 622986124 851053782 851053782 994997958 510301019 690457747 690457747 690457747 9949979…

Example 3:

Input: 2290 -164153568 -127245219 883739709 987606432 840275489 483472077 75958458 876336052 822793780 -140703050 796046997 -155241771 -741965205 -66819482 -699359449 -590061199 992773061 -965166216 -139807086 131276475 397791328 -41017369 706382874 559821574 -755576761 -692650652 823947554 97986126 -334321292 185438910 -662302625 -574102667 574353650 -429062040 -383597990 -951748580 -452703208 805335864 -167261237 74722186 734507405 -165356366 -789254941 -689483079 579279912 -681651678 534337639 931071013 -504738166 -385275344 -52996804 660281125 924632960 -704772570 -953381467 -414525179 -404406661 -380865481 -842305072 533508861 -58362166 846974276 -221579326 -898329397 443132596 -83072829 -481300889 367368344 -472131737 -850927165 62789403 383496082 194184183 410220794 900112164 -503575250 -5…
Output: -127245219 883739709 987606432 992773061 876336052 876336052 876336052 992773061 992773061 796046997 992773061 -66819482 -66819482 992773061 -590061199 992773061 997687078 -139807086 131276475 397791328 706382874 706382874 823947554 823947554 -692650652 823947554 931071013 185438910 185438910 574353650 -574102667 574353650 805335864 -383597990 805335864 -452703208 805335864 931071013 74722186 734507405 931071013 579279912 -689483079 579279912 931071013 534337639 931071013 992303268 -385275344 -52996804 660281125 924632960 992303268 -414525179 -414525179 -404406661 -380865481 533508861 533508861 846974276 846974276 900112164 443132596 443132596 900112164 367368344 367368344 383496082 62789403 62789403 383496082 410220794 410220794 900112164 908177952 604429168 604429168 908177952 908177952 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Brewer's Sunlit Ledger - MEDIUM Coding Problem | CodeTikki