CT37689

The ledgers at Bloomhaven

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Before the gates of the tulip beds of Bloomhaven close for winter, Trader 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: 2176 -154458498 292447253 159092820 318823927 227562108 531909834 260617284 -985923399 -120307195 872262226 -675609280 166528882 70865052 822416393 -232060017 -134270104 -287842328 157462581 -107136583 -345969426 798221425 293003964 817066684 641958663 606205648 817157173 419083796 625512718 869452761 -896374620 -115789527 666975459 -263337455 -923921753 -323324454 991662599 226302095 519816710 -307983869 -966065956 484775595 451181865 -2994818 533299992 965056469 -639627307 933320575 -58776198 700874347 984639057 246516509 71306211 302758491 373469094 865541552 -941130896 -115171117 447676565 173150942 397242075 -561336916 25318598 495134436 932144239 -927532163 64344348 397282410 -774222884 -249794557 -153788447 -863752366 -905008642 815244476 -308875123 666309424 -171364956 353401752 88…
Output: 292447253 318823927 318823927 531909834 531909834 872262226 872262226 -120307195 872262226 991662599 166528882 822416393 822416393 869452761 -134270104 157462581 157462581 798221425 798221425 798221425 817066684 817066684 817157173 817157173 817157173 869452761 625512718 869452761 991662599 -115789527 666975459 991662599 991662599 -323324454 991662599 992511876 519816710 533299992 484775595 484775595 533299992 533299992 533299992 965056469 984639057 933320575 984639057 700874347 984639057 984908211 302758491 302758491 373469094 865541552 932144239 -115171117 447676565 495134436 397242075 495134436 25318598 495134436 932144239 976226385 64344348 397282410 815244476 -249794557 -153788447 815244476 815244476 815244476 888953724 666309424 888953724 353401752 888953724 976226385 716175301 76221…

Example 2:

Input: 1026 946023430 622664131 434177068 -609003836 349579342 5308411 -421362771 -555870753 7660768 -143900622 536983781 646567119 6825753 -115853007 998918513 -692748565 428855717 -241409333 12750034 -97203459 -178790436 551186949 212848400 329153284 46452737 851007878 269395605 -720583979 -298003674 -710579514 7998791 316608553 -66178776 -934241896 -761811113 -673965169 209782533 -52002138 -859798905 -527297209 -583787768 397363520 -50210606 440577316 154310305 -743096476 882279747 -878681713 -845067845 -23853897 901418553 -409654152 -763853694 -368500597 804875264 895060795 961389820 -8853929 -142055316 220351374 -183570050 995434733 -857970513 -647379737 900331143 784411276 -994752765 532138710 -878243375 496787136 -942418230 353187829 -560270646 -278848005 -350390087 -755893862 -754258643 9…
Output: 998918513 646567119 536983781 349579342 536983781 7660768 7660768 7660768 536983781 536983781 646567119 998918513 998918513 998918513 -1 428855717 551186949 12750034 551186949 551186949 551186949 851007878 329153284 851007878 851007878 882279747 316608553 -298003674 7998791 7998791 316608553 397363520 209782533 -761811113 -673965169 209782533 397363520 397363520 -527297209 397363520 397363520 440577316 440577316 882279747 882279747 882279747 901418553 -845067845 -23853897 901418553 961389820 -368500597 -368500597 804875264 895060795 961389820 995434733 220351374 220351374 995434733 995434733 997398183 -647379737 900331143 958738372 958738372 532138710 958738372 496787136 958738372 353187829 958738372 -278848005 958738372 958738372 -754258643 958738372 975770046 912558633 556578541 34808658…

Example 3:

Input: 3242 -996848413 -694517424 855195457 -373317800 400619532 237700413 701379151 405384629 831233651 -505246239 -485181853 -523718660 -736465967 -656897965 -556618669 -689154753 429404253 349417136 -931648676 19021152 -316651216 -737479536 333552586 -255827068 -407231745 -874821742 215325703 982807706 743214087 956907843 -199957791 631255621 -125059512 310935377 643097642 13579148 724574520 -293967611 794067605 302790367 -613409651 949127295 239639402 419390842 -967150820 -794832589 109150356 524579895 -825745327 414861947 -6904603 -347177969 -246837873 -559520997 554180761 -7257245 -212772969 900823681 609832083 159147266 491273004 -348499552 -152255540 14421356 879126950 69053927 -828725328 -347843731 -340146775 683991738 -726331498 508209171 -221810525 -443422357 -520345422 -667322960 -284…
Output: -694517424 855195457 982807706 400619532 701379151 701379151 831233651 831233651 982807706 -485181853 429404253 429404253 -656897965 -556618669 429404253 429404253 982807706 982807706 19021152 333552586 333552586 333552586 982807706 215325703 215325703 215325703 982807706 994544300 956907843 962119319 631255621 643097642 310935377 643097642 724574520 724574520 794067605 794067605 949127295 949127295 949127295 950713292 419390842 524579895 -794832589 109150356 524579895 554180761 414861947 554180761 554180761 -246837873 554180761 554180761 900823681 900823681 900823681 950713292 879126950 491273004 879126950 -152255540 14421356 879126950 950713292 683991738 -347843731 -340146775 683991738 871756999 508209171 612622775 309403092 -284020828 -284020828 -284020828 309403092 612622775 620108669 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The ledgers at Bloomhaven - MEDIUM Coding Problem | CodeTikki