CT51654

Mira's Ledger of signals

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Mira inherited the loft at the ribbon falls of Cascade Vale along with its curious bookkeeping system for signals. 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: 2433 480890196 937748768 -217041913 513368046 -35800840 592951815 -726727703 619200387 685101008 22469818 -179555538 -875233113 -64680486 -989086525 -362389868 -514075069 356319981 304669795 -515525204 -171491660 836920361 663824921 -292601332 -241876738 -150305800 -808925703 461127173 -222463225 -670522181 -12042956 -659669103 960357131 -456614553 -243918878 438559902 960561680 866126594 -772033012 68944839 153280195 -913430397 -38025576 -202559926 -484901825 -972059818 -440460211 685780018 -757535276 -704890748 764557754 -413867430 858808367 663894788 -998179071 -166792353 -344051599 109038286 539946221 528149366 -6625297 -656855537 -48977637 -362775081 -566098060 -384989486 848304485 842529112 880132648 934174021 849231971 -581739701 490377292 -846869464 -497948732 713177142 -59418672 -…
Output: 937748768 960357131 513368046 592951815 592951815 619200387 619200387 685101008 836920361 356319981 -64680486 -64680486 356319981 -362389868 356319981 356319981 836920361 836920361 -171491660 836920361 960357131 960357131 -241876738 -150305800 461127173 461127173 960357131 -12042956 -12042956 960357131 960357131 960561680 -243918878 438559902 960561680 963479171 880132648 68944839 153280195 685780018 -38025576 685780018 685780018 -440460211 -440460211 685780018 764557754 -704890748 764557754 858808367 858808367 880132648 848304485 -166792353 109038286 109038286 539946221 848304485 848304485 848304485 -48977637 848304485 848304485 -384989486 848304485 880132648 880132648 934174021 963479171 908264185 490377292 713177142 -497948732 713177142 763358844 763358844 763358844 908264185 482997346 …

Example 2:

Input: 1832 966335519 489644967 -543043302 466614953 169920724 -716328587 -362166058 -684631458 -782441401 -552816060 -134155590 184767493 -228354220 968722574 832983200 421238540 -283003957 956049994 -757701807 888816481 820282382 -212906625 311706149 51136130 -26706659 166708811 12797413 -331678379 307564698 -199508764 -516037174 529864583 347932680 -145387801 328865369 -110937074 -39203249 -325697657 -557732736 562754491 -42814570 795980623 3942694 -508629959 372625309 298724646 671948113 444614916 309553197 962689557 -609475739 606941137 699449849 -464101017 -20987678 835354896 155536737 577665556 -793057754 -800549856 -981500372 -45084415 961580007 927227294 121825430 -904378144 -134113131 -660983807 130812454 -661042886 -132645408 -65033928 754906289 321889214 -606640113 915461898 -35395856…
Output: 968722574 968722574 466614953 968722574 184767493 -362166058 -134155590 -552816060 -552816060 -134155590 184767493 968722574 968722574 993390858 956049994 956049994 956049994 962689557 888816481 962689557 962689557 311706149 529864583 166708811 166708811 307564698 307564698 307564698 529864583 529864583 529864583 562754491 562754491 328865369 562754491 -39203249 562754491 562754491 562754491 795980623 795980623 962689557 372625309 372625309 671948113 671948113 962689557 962689557 962689557 993390858 606941137 699449849 835354896 -20987678 835354896 961580007 577665556 961580007 -45084415 -45084415 -45084415 961580007 962121489 962121489 130812454 -134113131 130812454 130812454 754906289 -132645408 -65033928 754906289 915461898 915461898 915461898 962121489 307012699 697419733 -89620191 697…

Example 3:

Input: 2807 -552256851 563489439 906851998 -667247983 -584635960 922443049 885644719 923585619 300218242 403892272 -459863895 453987645 -947299687 632426120 -750360753 23139420 660953032 -961441256 -898968700 -745006924 -605572584 907663648 395792388 794522041 217130704 -437297337 883709480 932474715 -217679558 967746415 -905362824 397425876 776292644 814801579 824524639 826983157 565278192 -344006467 -594095970 482524197 784450095 -341362092 942832180 173780539 -44776148 831905840 774336959 640741599 -199747911 -443844381 -806789722 675001988 661935398 918657630 288741531 236734669 -920676576 -939457221 -849554772 -422901185 -383076670 478613271 853131998 812122872 -956915009 -974730480 -527896137 -640624459 773301005 -113584233 815330306 142944052 -690359455 164857010 741802341 -120996409 91047…
Output: 563489439 906851998 922443049 -584635960 922443049 923585619 923585619 932474715 403892272 453987645 453987645 632426120 632426120 660953032 23139420 660953032 907663648 -898968700 -745006924 -605572584 907663648 932474715 794522041 883709480 883709480 883709480 932474715 967746415 967746415 989461778 397425876 776292644 814801579 824524639 826983157 942832180 784450095 482524197 482524197 784450095 942832180 942832180 989461778 831905840 831905840 918657630 918657630 675001988 675001988 675001988 675001988 918657630 918657630 989461778 478613271 478613271 -849554772 -849554772 -422901185 -383076670 478613271 853131998 910478874 815330306 -527896137 -527896137 773301005 773301005 815330306 815330306 910478874 164857010 164857010 741802341 910478874 910478874 917881658 377456552 561892955 6…

Constraints:

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

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