CT39835

Minstrel's Ledger of signals

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The tallyman Minstrel has been asked to settle the inheritance fairly. On the desk lies a long table of signals readings. 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: 1215 -580476710 -280445922 624864147 200016783 -212948472 680742174 431170168 -94249693 -479585193 -722944649 267543862 -885263440 -833161631 -872395972 -112829124 684842817 -968632629 -988540917 916966212 -394927295 159054814 -912833538 560474452 724477037 502695360 24886819 717212241 -582726656 738876915 -956805659 978461570 922249082 -856697770 -666821574 511345405 520005198 343978780 64287666 848736687 -346776928 925233341 -565907753 -550673117 974096929 -678596780 539482076 -146834293 -737254383 -793588906 740397880 382442381 -640915267 880791891 181777514 31441413 -412155311 311423666 -236051949 557404114 312307818 -922609180 348303226 475227399 63864564 -779762657 543341969 843400808 249344268 845970727 328382096 808364375 -16785074 -176887682 -949705426 -891831966 -705199335 335645…
Output: -280445922 624864147 680742174 680742174 680742174 684842817 684842817 267543862 267543862 267543862 684842817 -833161631 -112829124 -112829124 684842817 916966212 916966212 916966212 978461570 159054814 560474452 560474452 724477037 738876915 717212241 717212241 738876915 738876915 978461570 978461570 994160773 925233341 -666821574 511345405 520005198 848736687 848736687 848736687 925233341 925233341 974096929 -550673117 974096929 994160773 539482076 740397880 740397880 740397880 740397880 880791891 880791891 880791891 929056550 311423666 311423666 311423666 557404114 557404114 843400808 348303226 348303226 475227399 543341969 543341969 543341969 843400808 845970727 845970727 929056550 808364375 929056550 335645210 335645210 -891831966 -705199335 335645210 516031144 -322264991 516031144 5…

Example 2:

Input: 2412 -248696664 -367422175 714535930 205994075 -735719219 367678757 -61576090 700619602 88179509 -972510556 222573319 -13375890 -82488794 865577813 -349092799 924663225 -641911085 -803001621 -913865511 581827363 863407792 135686833 517359177 205195707 628348704 11682405 192054912 -895769145 -207798271 -31505326 -903712488 -305286090 -468477095 -969918243 -775903147 15942762 -231441789 -299391838 -345452784 642408489 764108414 -902705610 -877392739 840777591 891709066 304683429 -705510700 393008815 -900366983 -309806820 -218102123 -756286191 -779160054 -380585782 -441900210 390224462 475923582 124652163 -270732146 -693845437 -927565050 745490681 -541237081 458375829 -753195726 500315863 -439950139 -39521182 -329739264 -776106980 817745705 -741438586 -832549714 -314991978 -410244180 -3475200…
Output: 714535930 714535930 865577813 367678757 367678757 700619602 700619602 865577813 222573319 222573319 865577813 865577813 865577813 924663225 924663225 979784842 581827363 581827363 581827363 863407792 891709066 517359177 628348704 628348704 642408489 192054912 642408489 -207798271 -31505326 15942762 -305286090 15942762 15942762 -775903147 15942762 642408489 642408489 642408489 642408489 764108414 840777591 -877392739 840777591 891709066 979784842 393008815 393008815 475923582 -309806820 -218102123 390224462 -380585782 -380585782 390224462 390224462 475923582 745490681 745490681 745490681 745490681 745490681 817745705 458375829 500315863 500315863 817745705 -39521182 817745705 817745705 817745705 888831365 -314991978 -314991978 599868870 -347520005 599868870 659720803 176003134 210333677 659…

Example 3:

Input: 1507 232928114 322885978 -563534769 126607042 -780329580 -416024942 -456267740 828160735 934779837 167409711 705698126 352266750 697127959 72897404 418221548 290280391 -275192218 -587569774 676134746 985352153 -634830518 435820048 -616168850 -950641987 82377743 -831858287 -698955186 -329470362 -592051140 -63294044 -445546691 -698695012 -124271366 838674043 -115747342 -174884601 46666773 670441328 -962886729 -749275897 -652585946 -221069455 -532046287 147296098 500976123 333132153 15306918 -700351456 -809801180 19776690 -384984887 18082396 394627295 436908090 -418026482 -339410396 312856078 -108742378 547172601 119050207 885260836 205731907 -994060931 -393850244 -869426765 112784989 -760879532 459509212 411708217 -529313756 578825485 -234880127 385825629 118178821 641401747 -630770995 -5415…
Output: 322885978 828160735 126607042 828160735 -416024942 828160735 828160735 934779837 985352153 705698126 985352153 697127959 985352153 418221548 676134746 676134746 676134746 676134746 985352153 987479889 435820048 838674043 82377743 82377743 838674043 -698955186 -329470362 -63294044 -63294044 838674043 -124271366 -124271366 838674043 885260836 46666773 46666773 670441328 885260836 -749275897 -652585946 -221069455 147296098 147296098 500976123 547172601 394627295 19776690 19776690 19776690 394627295 18082396 394627295 436908090 547172601 -339410396 312856078 547172601 547172601 885260836 885260836 934660560 459509212 -393850244 112784989 112784989 459509212 459509212 578825485 578825485 578825485 641401747 385825629 641401747 641401747 934660560 -541544729 328869129 456029840 -11354201 -529987…

Constraints:

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

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