CT45547

The Taller Ahead of Thimblewick

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Caravans arrive at the wren hedges of Thimblewick with crates of ledgers, and Minstrel the tallyman must account for every last one. 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: 109 895365801 409570487 -454777947 154642622 -586912771 151781298 -31176906 -978791175 406769950 -323830833 -189083288 -23870305 -975266555 -65226316 -575499837 -368754007 765005288 -577747905 -422185421 832898069 -380681221 -938547583 438202885 158771760 -160787118 615549144 981949538 -18518130 657701531 475034619 -242462878 480732882 828114246 783509342 -285280899 262350718 224451379 458726569 -924075798 626706074 611810582 -948887445 592716293 -786145008 564568557 -20888492 -800857020 -851557253 533886354 223836354 -448263532 -509707840 456232936 -858752800 822914665 615715338 875173629 -768159967 4088106 335592372 -474961912 456126102 134304458 -975709721 -417433074 901689134 -355995822 -468759587 -800498233 -63844963 -964585852 -597907499 -669281794 400792107 -566376248 461292986 -531…
Output: 981949538 765005288 154642622 406769950 151781298 406769950 406769950 406769950 765005288 -189083288 -23870305 765005288 -65226316 765005288 -368754007 765005288 832898069 -422185421 832898069 981949538 438202885 438202885 615549144 615549144 615549144 981949538 -1 657701531 828114246 480732882 480732882 828114246 875173629 822914665 262350718 458726569 458726569 626706074 626706074 822914665 822914665 592716293 822914665 564568557 822914665 533886354 533886354 533886354 822914665 456232936 456232936 456232936 822914665 822914665 875173629 875173629 901689134 4088106 335592372 456126102 456126102 901689134 901689134 -417433074 901689134 945455080 -63844963 -63844963 -63844963 400792107 -597907499 400792107 400792107 461292986 461292986 945455080 945455080 954979079 747172980 954979079 2265…

Example 2:

Input: 2035 -870253775 -965953508 -513725964 416284228 455978694 670280152 -807506872 -996719466 -370537391 -628584976 363513588 -488896938 149683857 -929082318 -918703838 -194294632 -450420322 -7266281 -410268980 -898992524 -899708383 -388131485 67305897 -659189051 781862922 -107287652 240773503 -648413658 -93587803 954404910 93484554 220019215 31310011 692426720 631799249 -525138592 27807781 -540433083 -499490250 192415247 372074975 139701774 -928952320 -76789677 32194408 657517964 234183132 611391993 -888986936 289789722 -955579964 -629802842 643901820 409977985 876677491 207075208 836108498 -258088753 702146541 399519859 -555746856 -87776442 -376844957 122214723 -60784526 252198243 -59208078 -439597966 926897326 -900779683 788437335 624875167 -993282941 -843959310 410861115 -717639167 -560193…
Output: -513725964 -513725964 416284228 455978694 670280152 781862922 -370537391 -370537391 363513588 363513588 781862922 149683857 781862922 -918703838 -194294632 -7266281 -7266281 67305897 -388131485 -388131485 -388131485 67305897 781862922 781862922 954404910 240773503 954404910 -93587803 954404910 978821731 220019215 692426720 692426720 876677491 657517964 27807781 192415247 -499490250 192415247 372074975 657517964 657517964 -76789677 32194408 657517964 876677491 611391993 643901820 289789722 643901820 -629802842 643901820 876677491 876677491 926897326 836108498 926897326 702146541 926897326 926897326 -87776442 122214723 122214723 252198243 252198243 926897326 926897326 926897326 939477879 788437335 914704154 914704154 -843959310 410861115 914704154 -560193954 320997453 914704154 -182615034 91…

Example 3:

Input: 1528 -988254107 34718899 -437402945 -670330880 -970518954 -485740994 -704794822 -874997260 10625613 -378529074 975805768 149136526 -936430302 -905180524 -355742495 -433300138 -241205953 999376090 -561407185 104740203 345870614 984406481 -472649431 693855845 -401552033 -165111174 323318205 299507854 -752777171 934829631 535883197 694145727 589748648 -710698756 -626651757 -397253310 -752850897 37097652 450547741 115967801 -816414633 -982878932 452358133 -379677189 55508425 15430101 -506477449 -955498153 -306815653 311221506 -728282942 -115765862 281263235 -51929340 -647341705 219197720 656805809 853638408 -876234130 -611170754 -942553978 -977382994 -320735257 240043752 -584296207 -846452634 -76736010 -822185733 273859607 645567105 -933619851 -215282325 390290266 336040854 406604055 933889779…
Output: 34718899 975805768 10625613 -485740994 -485740994 10625613 10625613 10625613 975805768 975805768 999376090 999376090 -905180524 -355742495 -241205953 -241205953 999376090 999695224 104740203 345870614 984406481 988407861 693855845 934829631 -165111174 323318205 934829631 934829631 934829631 939016762 694145727 853638408 656805809 -626651757 -397253310 37097652 37097652 450547741 452358133 452358133 452358133 452358133 656805809 55508425 311221506 311221506 -306815653 -306815653 311221506 656805809 -115765862 281263235 656805809 219197720 219197720 656805809 853638408 933889779 -611170754 -320735257 -320735257 -320735257 240043752 273859607 -76736010 -76736010 273859607 273859607 645567105 933889779 -215282325 390290266 406604055 406604055 933889779 939016762 301798400 387646253 702423056 7…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.