CT46079

The Taller Ahead Beneath Thimblewick

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Deep in the wren hedges of Thimblewick, Gino studies rows of registers entries. One clean number will settle the guild's oldest argument. 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: 1891 -747060878 -47102111 222828803 993153123 559451306 -727168058 -102366523 -330755485 945503891 -15931628 -859323099 -548477107 -427046607 290887547 764527350 -999982787 588195265 296661809 670155826 88329122 -938618661 435347280 394669743 283975048 -88076749 864188140 162996456 589869695 -156257064 -278535240 -574215747 300860629 -306673233 767254580 -472506303 783223432 220490004 315706516 -651852323 -990048642 653017300 440694571 -661935670 -492920185 -247475951 -321278874 -870616360 850435998 -704018408 699414837 146106205 215763436 -13784031 232800035 319846154 272299254 -897163464 27744044 -478572659 -260692596 -276975537 567307279 -646372298 426858350 -610301122 269742871 325257769 21890218 602143694 -962499260 -680362238 -117058893 658543845 -812831391 -1254245 317393882 -713379…
Output: -47102111 222828803 993153123 996216826 945503891 -102366523 945503891 945503891 996216826 290887547 -548477107 -427046607 290887547 764527350 864188140 588195265 670155826 670155826 864188140 435347280 435347280 864188140 864188140 864188140 864188140 908332823 589869695 767254580 300860629 300860629 300860629 767254580 767254580 783223432 783223432 850435998 315706516 653017300 653017300 653017300 850435998 850435998 -492920185 -247475951 850435998 850435998 850435998 908332823 699414837 908332823 215763436 232800035 232800035 319846154 567307279 567307279 27744044 567307279 -260692596 567307279 567307279 602143694 426858350 602143694 269742871 325257769 602143694 602143694 658543845 -680362238 -117058893 658543845 908332823 -1254245 317393882 478747836 478747836 544915964 544915964 9083…

Example 2:

Input: 2368 790045813 869950639 34934461 -929364085 168131995 -141744704 -295551182 -317531125 -314041101 -936204875 -992462972 -526489622 -565128520 -482515839 -365999565 906635707 828287044 348333035 661100531 -505623567 -787754211 790736940 395409177 -318373540 -197877678 904389952 -483521791 33336548 176841669 383308401 596998977 -920800049 650255019 -282501209 -381645442 -546625341 -975287462 439541323 133181663 417986330 -12555213 -126099708 -514982818 -266524854 172600974 609268145 -723242760 -309002485 566747749 792713272 597887336 632275748 -828289192 927747010 -777591071 52511697 610201036 395527925 -197362606 942092156 -776460282 653617113 -51182471 963040994 -244545866 851094134 -124254424 516965957 859408164 417497881 649697217 -332251683 -868010011 -593435382 364749505 -255303719 36…
Output: 869950639 906635707 168131995 168131995 906635707 906635707 906635707 -314041101 906635707 -526489622 -526489622 -482515839 -482515839 -365999565 906635707 927747010 904389952 661100531 790736940 790736940 790736940 904389952 904389952 -197877678 904389952 927747010 33336548 176841669 383308401 596998977 650255019 650255019 792713272 439541323 439541323 439541323 439541323 609268145 417986330 609268145 172600974 172600974 -266524854 172600974 609268145 792713272 -309002485 566747749 792713272 927747010 632275748 927747010 927747010 942092156 52511697 610201036 942092156 942092156 942092156 963040994 653617113 963040994 963040994 978165698 851094134 859408164 516965957 859408164 978165698 649697217 786792955 364749505 -593435382 364749505 786792955 362266117 786792955 786792955 978165698 97…

Example 3:

Input: 1294 298923092 429143015 -384486817 519016462 -801117357 -474971238 72852965 928602764 -96007590 310154948 300736986 733696206 118833061 -738974170 -308621285 -103793768 299138213 -57027886 355256101 -271980989 -356437137 -15025978 154073383 314248735 -191445605 926825435 -676323216 -774166112 -964319296 40068485 810474088 617879029 78654469 696568869 -90092528 -867072672 868768874 -563344933 568822985 735246342 -223020384 98585584 881155500 482521188 481796968 -318053305 -556788083 -915355060 723247846 624044285 -699667470 -861879520 681418735 -172310390 -169744167 -548231034 779844485 -900204446 -119515534 -802492345 311485919 -716467723 -165269366 509217236 369241955 -379574284 -575352475 174783903 -158561844 243942475 -322634009 533241181 308149699 -233750361 822063569 854528186 347914…
Output: 429143015 519016462 519016462 928602764 -474971238 72852965 928602764 934367289 310154948 733696206 733696206 926825435 299138213 -308621285 -103793768 299138213 355256101 355256101 926825435 -15025978 -15025978 154073383 314248735 926825435 926825435 934367289 40068485 40068485 40068485 810474088 868768874 696568869 696568869 868768874 868768874 868768874 881155500 568822985 735246342 881155500 98585584 881155500 934367289 723247846 723247846 723247846 723247846 723247846 779844485 681418735 681418735 681418735 779844485 -169744167 779844485 779844485 822063569 -119515534 311485919 311485919 509217236 -165269366 509217236 533241181 533241181 174783903 174783903 243942475 243942475 533241181 533241181 822063569 822063569 822063569 854528186 934367289 613137907 -515063866 613137907 61313790…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Taller Ahead Beneath Thimblewick - MEDIUM Coding Problem | CodeTikki