CT43915

Mina's Ledger of ledgers

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

At the singing sands of Echo Dunes, Mina records each ledgers in a worn leather ledger. The guild wants answers, not guesses. 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: 3620 969840978 -500522213 -917279510 -302027694 -977830053 512587432 -512204806 -753481383 120620792 363105161 -385938679 665884328 -327931829 -762085172 363734471 -188605308 980768407 -534159965 -394939091 -173186092 551745788 -824910967 480586690 -896327139 -434350352 -102203689 -437678703 351645030 -277628275 -870011528 -359288480 -228659703 -550502062 320402074 -258874064 -976542284 686389634 -171738585 898632863 7722502 -397225376 -101540509 743618319 -790798336 189221088 -574681906 -799565516 -70013582 -132597448 -464157229 -899404358 -349816214 213178467 -954081874 526916421 -560045730 -627938717 -77468094 539346676 -594174247 813380734 412489853 649173325 -268343186 924810749 -188016589 308969289 -206339541 -793855493 115849559 598096580 -573025305 526657365 -691043501 95595812 -47…
Output: 980768407 -302027694 -302027694 512587432 512587432 665884328 120620792 120620792 363105161 665884328 665884328 980768407 363734471 363734471 980768407 980768407 984287307 -394939091 -173186092 551745788 686389634 480586690 686389634 -434350352 -102203689 351645030 351645030 686389634 -228659703 -359288480 -228659703 320402074 320402074 686389634 686389634 686389634 898632863 898632863 924810749 743618319 -101540509 743618319 813380734 189221088 213178467 -70013582 -70013582 213178467 213178467 -349816214 -349816214 213178467 526916421 526916421 539346676 -77468094 -77468094 539346676 813380734 813380734 924810749 649173325 924810749 924810749 977229973 308969289 598096580 115849559 115849559 598096580 695725821 526657365 597691792 95595812 504460088 504460088 597691792 597691792 597691792…

Example 2:

Input: 809 -687300673 -875510514 337200872 71443130 -468807691 -868002789 918731280 994314760 -459778088 -842451788 -506799952 522935228 689761137 463633888 -6677735 -723929975 934557871 743016681 -622963777 -877395897 657657191 495817681 -550721932 679331054 -407886831 11021016 913805351 3383516 278391833 -594015918 -516065243 109553136 575158558 -200802791 479228641 598957649 -748603626 450732727 762720399 923981439 577479890 145160031 874843169 -370061962 -18391669 414589255 -75884398 -728429204 498003086 -107082337 804942117 -742462556 192802634 -376694330 -542810371 -742198992 685010193 -794897723 177198067 -56536922 -313008237 -766317427 497330242 -89916849 -51908973 -766780149 755798170 579928714 284754125 -718988289 -567452847 80719707 -175959723 -306672898 930558121 332971181 318997955 4…
Output: 337200872 337200872 918731280 918731280 918731280 918731280 994314760 999738890 522935228 -506799952 522935228 689761137 934557871 934557871 934557871 934557871 973220366 913805351 657657191 657657191 679331054 679331054 679331054 913805351 11021016 913805351 923981439 278391833 575158558 -516065243 109553136 575158558 598957649 479228641 598957649 762720399 450732727 762720399 923981439 930558121 874843169 874843169 930558121 -18391669 414589255 498003086 498003086 498003086 804942117 804942117 930558121 192802634 685010193 685010193 685010193 685010193 755798170 177198067 497330242 497330242 497330242 497330242 755798170 -51908973 755798170 755798170 930558121 930558121 930558121 -567452847 80719707 930558121 930558121 930558121 973220366 448154400 448154400 582083124 924995369 973220366…

Example 3:

Input: 2868 461886050 181383186 -251192463 -951176838 -341118347 440146062 -774955632 649359453 524188285 171934334 439792747 -615879910 675125311 -703226347 49104088 -903470714 333399038 -367812324 -346471493 -640664585 904369110 -46797864 261111125 -766897927 -37982945 -741844488 -861466994 130523756 823789325 791133972 -148373327 311365645 118023383 537985887 478403546 44451329 165242249 612914357 -797943271 103278826 -29070316 -46440954 332997299 892810227 -993157009 680179043 371180352 6860679 251057566 709119645 -683405217 -220331554 732664531 979735470 125823792 -134848890 871543480 -256803021 -136333619 346687601 131310826 505163212 -463187533 -899649209 -803179441 168789286 785470099 518497024 -486503269 -186430155 -487696990 -660146567 461262792 452261430 -20404690 397567362 412100566 2…
Output: 649359453 440146062 440146062 -341118347 440146062 649359453 649359453 675125311 675125311 439792747 675125311 675125311 904369110 49104088 333399038 333399038 904369110 -346471493 904369110 904369110 979735470 261111125 823789325 -37982945 130523756 130523756 130523756 823789325 892810227 892810227 311365645 537985887 537985887 612914357 612914357 165242249 612914357 892810227 103278826 332997299 332997299 332997299 892810227 979735470 680179043 709119645 709119645 251057566 709119645 732664531 -220331554 732664531 979735470 998197032 871543480 871543480 953630138 -136333619 346687601 505163212 505163212 785470099 168789286 -803179441 168789286 785470099 865319434 554221622 -186430155 461262792 461262792 461262792 554221622 554221622 397567362 412100566 554221622 554221622 776420240 86531…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Mina's Ledger of ledgers - MEDIUM Coding Problem | CodeTikki