CT48823

The Taller Ahead at Brimstone

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

It is audit day at the sulphur springs of Brimstone. Forester spreads the registers records across the table and picks up a sharp pencil. 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: 592 405872008 -960611023 -653624290 -433084229 914056028 753441308 -915498793 -840464536 -403450035 819159651 755597851 722497884 -923018828 43972812 620889932 134247383 -927991603 644223698 -976906375 965744403 288007446 -85807761 -420177874 -110444771 432452331 -426583448 -12107003 -842086401 -741633961 536353668 -908319295 -487660193 814173929 343309905 -847535898 -836619952 -193117043 25243173 -595191710 978849240 419682883 99404525 -152876122 187988952 193519693 -883532797 879565412 91274386 676255655 674605183 -315405458 -851365367 928684127 242138012 61324166 850689778 -165565887 -116943439 283543359 -685780948 871910533 537840935 143850315 -351552738 260169475 -231371608 -700865088 721377596 -285346879 231245595 -927437989 552837022 -473569545 -149365754 -895714238 -541297283 97737…
Output: 914056028 -653624290 -433084229 914056028 965744403 819159651 -840464536 -403450035 819159651 965744403 965744403 965744403 43972812 620889932 644223698 644223698 644223698 965744403 965744403 978849240 432452331 432452331 -110444771 432452331 536353668 -12107003 536353668 -741633961 536353668 814173929 -487660193 814173929 978849240 978849240 -836619952 -193117043 25243173 978849240 978849240 990936082 879565412 187988952 187988952 193519693 879565412 879565412 928684127 676255655 928684127 928684127 928684127 928684127 929392332 850689778 850689778 871910533 -116943439 283543359 871910533 871910533 924721415 721377596 260169475 260169475 721377596 721377596 721377596 727142458 231245595 552837022 552837022 727142458 -149365754 97737730 -541297283 97737730 727142458 781504747 781504747 78…

Example 2:

Input: 2826 -186262565 -711010059 -286445612 263665519 155851911 -849655559 956585661 24542648 -603790834 -868154266 -78897647 406786131 -68957773 -675564552 -371251789 200526887 -198530615 -803824212 237410120 -556454717 -894733185 950410655 620783680 376899494 873561218 -847888074 408338074 -283800176 -277037378 465008352 -942606385 -283705823 241259195 121610651 641158288 48745677 -859162507 -34693514 770746552 549777531 -606798472 215489169 -894176376 -370842024 833379553 -662823204 955454307 798209941 545579304 114852236 -269847931 -852312064 192337386 -866545192 618403616 -68608189 136267279 430137788 357485813 -739455823 91859002 -878795549 -146103771 739817624 -877031692 -915937951 913097879 -598144700 437496719 -326535259 133280938 -354633264 367774883 -997911111 690405510 -569311512 286…
Output: 263665519 -286445612 263665519 956585661 956585661 956585661 969717879 406786131 -78897647 -78897647 406786131 950410655 200526887 -371251789 200526887 237410120 237410120 237410120 950410655 950410655 950410655 955454307 873561218 873561218 955454307 408338074 465008352 -277037378 465008352 641158288 -283705823 241259195 641158288 641158288 770746552 770746552 -34693514 770746552 833379553 833379553 215489169 833379553 -370842024 833379553 955454307 955454307 969717879 913097879 618403616 192337386 192337386 192337386 618403616 618403616 739817624 136267279 430137788 739817624 739817624 91859002 739817624 -146103771 739817624 913097879 913097879 913097879 969717879 437496719 690405510 133280938 367774883 367774883 690405510 690405510 796158947 286871432 584954788 584954788 584954788 79615…

Example 3:

Input: 3846 223813707 -338211053 -316654614 -599885331 -88025167 -526192547 159432836 192425295 867279113 613861970 -847835179 372010189 -113364410 341383210 -577647871 -977448705 -153716052 125419865 -24196026 -746322099 843959377 -724338819 265997967 -802486172 466040862 825802712 -938489877 -380116734 118216841 477924723 -405207856 900410631 -447199836 -471517075 651084518 -367153026 521355186 896978817 3288450 -507187696 -40334547 -741513384 782836990 464296828 899674753 549582812 200553620 -111002220 -22550410 -563497476 -558685924 152453679 -1547767 865859722 -377399615 -181907622 657605511 580137159 382176186 694984796 589293835 8331717 -383576177 880876139 354286697 -275433186 715576644 455772762 230736868 815049945 -735040258 318908390 44627447 812691740 52686381 478253930 -772076100 -30…
Output: 867279113 -316654614 -88025167 -88025167 159432836 159432836 192425295 867279113 900410631 843959377 372010189 843959377 341383210 843959377 -153716052 -153716052 125419865 843959377 843959377 843959377 900410631 265997967 466040862 466040862 825802712 900410631 -380116734 118216841 477924723 900410631 900410631 995550676 651084518 651084518 896978817 521355186 896978817 899674753 782836990 -40334547 782836990 782836990 899674753 899674753 995550676 865859722 865859722 -22550410 152453679 -558685924 152453679 865859722 865859722 880876139 -181907622 657605511 694984796 694984796 694984796 880876139 880876139 880876139 880876139 995550676 715576644 715576644 815049945 815049945 815049945 995550676 318908390 812691740 812691740 995550676 478253930 792214453 -307792537 332345708 332345708 792…

Constraints:

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

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