CT54394

Miller's registers Taller Ahead

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Every season at the foggy moor of Greyfen, someone must win the guild's seasonal contest. This year the task falls to Miller, armed only with the registers register. 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: 676 673067172 -256526345 -71078098 -299888296 218337597 682550512 -970467760 -227673546 357965832 -806186859 -779436441 442774164 633482649 455395437 -665067975 -640152461 -103329 -921029499 -13371202 403193731 -590929576 700479834 125226524 555043707 161404956 279598901 520050381 158319679 742434468 -118876739 408708170 62306791 624854416 688200878 510106309 942886443 -424291489 816533067 -674421118 -674217560 574860826 -914094566 621292505 665446723 -277049053 253392988 -230188125 -565139268 657630519 820462075 -96663335 -192212143 -964679381 -861979771 280064 -231581917 160196148 -452334661 27325073 83643953 383170146 -675898934 -139423428 -763210644 -633509183 100519394 -974574177 -393481011 561242932 638213028 548402580 768363492 747293661 -947402268 -141557815 -455513508 -819272051 -…
Output: 682550512 -71078098 218337597 218337597 682550512 700479834 -227673546 357965832 442774164 -779436441 442774164 633482649 700479834 700479834 -640152461 -103329 403193731 -13371202 403193731 700479834 700479834 742434468 555043707 742434468 279598901 520050381 742434468 742434468 942886443 408708170 624854416 624854416 688200878 942886443 942886443 976914630 816533067 820462075 -674217560 574860826 621292505 621292505 665446723 820462075 253392988 657630519 657630519 657630519 820462075 926795311 280064 280064 -861979771 280064 160196148 160196148 383170146 27325073 83643953 383170146 561242932 -139423428 100519394 -633509183 100519394 561242932 -393481011 561242932 638213028 768363492 768363492 926795311 926795311 -141557815 -6596303 -449429515 -449429515 -6596303 647154291 926795311 9769…

Example 2:

Input: 2180 -536335541 506729716 -258090142 333014102 89152402 923380470 802298812 791844315 -705157846 -401327206 -230454627 468230929 201294016 210023804 -385647554 200303804 -26303874 390078204 -186271747 -417592285 163559159 -910040291 -863561973 -631489096 338257037 -350865911 -135756048 -233478884 94160543 -474022790 -741967450 902942458 -594918281 -970140540 -881021802 27182309 431107829 -566462560 -265601796 -192549030 -316731413 661499518 -165187319 620123046 -296662256 72700824 -786992466 475640385 -679994755 -26006014 457754982 -295262137 780924084 424759751 -162942447 587998984 -677865567 -557627184 429449203 -954748968 -51291440 -64096165 -33957105 -733110556 -877322225 592054916 681598044 -116149619 -638913669 -294532048 -773765921 884779320 653715049 562418317 -597855468 941076631 …
Output: 506729716 923380470 333014102 923380470 923380470 941076631 902942458 902942458 -401327206 -230454627 468230929 902942458 210023804 390078204 200303804 390078204 390078204 902942458 163559159 163559159 338257037 -863561973 -631489096 338257037 902942458 -135756048 94160543 94160543 902942458 902942458 902942458 941076631 27182309 -881021802 27182309 431107829 661499518 -265601796 -192549030 661499518 661499518 780924084 620123046 780924084 72700824 475640385 475640385 780924084 -26006014 457754982 780924084 780924084 884779320 587998984 587998984 592054916 -557627184 429449203 592054916 -51291440 -33957105 -33957105 592054916 592054916 592054916 681598044 884779320 884779320 -294532048 884779320 884779320 941076631 941076631 941076631 941076631 948711933 710045342 855806957 855806957 85580…

Example 3:

Input: 704 -345407401 -543820825 12749775 -900272282 765027088 799225134 926262035 735621299 -880413524 967081399 938998936 -551516868 -524483617 419226786 -232109957 660989185 364047478 164872377 897195216 -333853765 -569729972 -73689009 550445783 -97306702 -333314253 -706529427 -62364400 191777573 835058603 433209062 -124176451 767549318 -25825045 258608666 -622760302 -969531828 -868841547 -118065669 -369432345 -712255509 411337568 47073806 766502665 908949477 528568303 -172958777 -84527565 -83775224 -11141669 -26621064 993816922 174875959 -781378522 10277291 -679375387 -250233017 111523056 493032069 -856754728 -934917083 235393707 -93401829 146511304 -497153940 514832691 -76377185 151748119 442126260 -276433658 595888354 122286133 -814010534 724476455 735498819 -992204248 844491001 873281041 7…
Output: 12749775 12749775 765027088 765027088 799225134 926262035 967081399 967081399 967081399 993816922 993816922 -524483617 419226786 660989185 660989185 897195216 897195216 897195216 908949477 -73689009 -73689009 550445783 835058603 -62364400 -62364400 -62364400 191777573 835058603 908949477 767549318 767549318 908949477 258608666 411337568 -118065669 -868841547 -118065669 411337568 411337568 411337568 766502665 766502665 908949477 993816922 993816922 -84527565 -83775224 -11141669 993816922 993816922 995582489 493032069 10277291 111523056 -250233017 111523056 493032069 514832691 235393707 235393707 514832691 146511304 514832691 514832691 595888354 151748119 442126260 595888354 595888354 724476455 724476455 724476455 735498819 844491001 844491001 873281041 903069327 849194097 849194097 90306932…

Constraints:

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

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