CT54101

The Obsidian Taller Ahead

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Morning light hits the observatory of Starfall as Fletcher unrolls the day's manifest of beacons. The tally will decide the next shipment. 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: 1995 749004468 76822972 733763912 779840730 -694954245 -492440808 -412156103 359614028 -132159613 -542242299 -743607691 295297706 861910551 -873717106 50107415 3204507 -333933730 858988937 620837766 -630157432 51976004 962135146 840652981 443795794 528203744 -155905190 582985306 -217991783 -66576650 -242926384 -171406999 310761941 238405502 938845898 -756650417 938016946 910280161 -647646013 827322279 784896570 -324974239 -186738239 -918471398 -882249004 -223822596 854972723 -9403875 -512285068 -516393967 952771077 -385205315 201612466 -554764574 -794344783 123346931 -77821813 228859951 484324976 -993748633 -294645995 952737850 891158920 -427792840 -89052340 -917683898 781693719 -413435256 318496061 529716291 -621056136 293003388 -493414006 733718613 91368538 -702500535 -425607184 90790279…
Output: 779840730 733763912 779840730 861910551 -492440808 -412156103 359614028 861910551 295297706 295297706 295297706 861910551 962135146 50107415 858988937 858988937 858988937 962135146 962135146 51976004 962135146 969391784 938845898 528203744 582985306 582985306 938845898 -66576650 310761941 -171406999 310761941 938845898 938845898 952771077 938016946 952771077 952771077 827322279 854972723 854972723 -186738239 854972723 -882249004 -223822596 854972723 952771077 952771077 952771077 952771077 969391784 201612466 228859951 123346931 123346931 228859951 228859951 484324976 952737850 -294645995 952737850 969391784 907902799 -89052340 781693719 781693719 907902799 318496061 529716291 733718613 293003388 733718613 733718613 907902799 907902799 -425607184 907902799 930399851 233883722 349382814 1521…

Example 2:

Input: 3844 -170081672 76783695 -747727589 880892086 -655460796 542567801 262440779 383038105 516136264 134742881 -465548374 651251022 -799337295 -784379316 -483859809 -259173545 -578185253 -838206438 -885669369 -21574123 -884096610 994568911 579497871 -723244745 470113699 -339910169 580121539 -690744867 -684285851 171210475 169571073 -582270047 -701082974 -113264806 972768481 63146088 198040950 858648791 346403000 277609029 253150182 -152906182 856063368 -768798408 690372015 432023407 416841757 -118036073 652898390 619912058 632984259 -692157795 -107936047 -141062031 29053270 -701507031 -779702978 -442884931 508390167 -744526463 -27565940 -288812613 142793530 225469318 973491851 -266017701 -61730431 -851765593 -213105178 -742216724 965461796 -844142260 394066297 595430677 791012496 599387580 105…
Output: 76783695 880892086 880892086 994568911 542567801 651251022 383038105 516136264 651251022 651251022 651251022 994568911 -784379316 -483859809 -259173545 -21574123 -21574123 -21574123 -21574123 994568911 994568911 995959083 580121539 470113699 580121539 580121539 972768481 -684285851 171210475 972768481 972768481 -113264806 -113264806 972768481 973491851 198040950 858648791 973491851 856063368 856063368 856063368 856063368 973491851 690372015 973491851 652898390 652898390 652898390 973491851 632984259 973491851 -107936047 29053270 29053270 508390167 -442884931 -442884931 508390167 973491851 -27565940 142793530 142793530 225469318 973491851 981374329 -61730431 965461796 -213105178 965461796 965461796 981374329 394066297 595430677 791012496 866113543 866113543 212701470 -50367135 212701470 212…

Example 3:

Input: 937 -905610056 -831955910 247140010 240451787 609505400 369598888 177600556 -898976094 -209040624 -142516116 -117445292 -982957675 954283456 54587830 140418959 -283571162 -692866206 656868724 423997544 116143409 848455018 760806436 -524847093 865036577 -200836225 567029353 504457615 584356963 525005712 -873562589 179806064 110942763 -341620574 -959950069 23827933 -155641278 556365676 660123488 499756662 688509651 -947077196 930886073 -842170774 676340935 27581811 807555655 22904783 -824593739 -330675683 189018052 -494045574 259046709 915498486 -597635205 522636552 -996823885 -525594952 222597314 794279676 -32477836 741422509 -669507587 -467892254 -979810296 -994560169 -50166450 610254850 626046672 -790093698 9992881 -174960459 -505874588 206725261 -328481965 759338234 248006932 630042711 -…
Output: -831955910 247140010 609505400 609505400 954283456 954283456 954283456 -209040624 -142516116 -117445292 954283456 954283456 981523623 140418959 656868724 656868724 656868724 848455018 848455018 848455018 865036577 865036577 865036577 930886073 567029353 584356963 584356963 660123488 556365676 179806064 556365676 556365676 23827933 23827933 556365676 556365676 660123488 688509651 688509651 930886073 930886073 981523623 676340935 807555655 807555655 915498486 189018052 -330675683 189018052 259046709 259046709 915498486 981523623 522636552 794279676 -525594952 222597314 794279676 981523623 741422509 759338234 -467892254 -50166450 -50166450 -50166450 610254850 626046672 759338234 9992881 206725261 206725261 206725261 759338234 759338234 981523623 630042711 981523623 981523623 993095216 9651474…

Constraints:

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

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