CT42071

Wamika and the Taller Ahead

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Morning light hits the port of Emberfall as Wamika unrolls the day's manifest of signals. 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: 830 958004198 157418111 523841783 812851120 -151822593 635823421 -444668752 170173458 -279778496 463546653 -495932760 502157201 813583930 173953417 -341834832 122531096 -2979783 -63512212 -310148939 499945738 778778295 -566751474 587082594 -93563801 -854864440 -505609299 248344521 -726355087 -893113156 448596468 105250482 -830792219 -239086171 -652021088 -336627988 -89354136 290759438 -507489903 -263269892 -539816169 948305106 921784754 772175044 -521342849 818824193 -874278959 -306848190 -76407843 -333346679 207331963 -813834146 -549898937 490143142 986378353 -303500208 356260298 -837125766 -131184138 833299835 -948623370 -526445684 672673193 -392814781 -687118263 976253379 837026935 -179614663 -215724941 -219192450 392652872 404725664 78333387 -276974524 -639453212 46863121 -930308466 -2…
Output: 986378353 523841783 812851120 813583930 635823421 813583930 170173458 463546653 463546653 502157201 502157201 813583930 948305106 499945738 122531096 499945738 499945738 499945738 499945738 778778295 948305106 587082594 948305106 248344521 -505609299 248344521 448596468 448596468 448596468 948305106 290759438 -239086171 -89354136 -336627988 -89354136 290759438 948305106 -263269892 948305106 948305106 986378353 986378353 818824193 818824193 986378353 -306848190 -76407843 207331963 207331963 490143142 -549898937 490143142 986378353 994041412 356260298 833299835 -131184138 833299835 976253379 -526445684 672673193 976253379 976253379 976253379 980634443 838645664 392652872 392652872 392652872 404725664 625860521 360985122 46863121 46863121 360985122 -234517570 360985122 625860521 838645664 545…

Example 2:

Input: 2276 899175766 490686331 -435715005 -862812795 -218398835 -541908356 -28104478 478538006 -270073787 487571357 -118675156 -916800980 -568981587 -294498988 -85027917 162300785 -273586216 134684999 982109312 -575443337 -544183345 -500466815 -838290886 -138314433 -37748569 164882322 -830132044 910934226 943699025 -133458387 -447923958 413181328 771798486 322513397 221815719 649528598 642019775 327640474 -775313695 -647548627 343224013 -59060666 -917030866 -735820139 -828599851 -927387326 -605747344 8319566 265736018 -200553299 -563618685 -344548263 -618846555 -978843546 535195811 -754725528 -948185508 -198299792 -894955351 -600287293 -138641524 170528982 959230347 -672721513 384230672 286983570 528361624 131805819 822292845 343115791 17725998 7506856 401820957 -162481056 373008270 -116485677 4…
Output: 982109312 982109312 -218398835 -218398835 -28104478 -28104478 478538006 487571357 487571357 982109312 -85027917 -568981587 -294498988 -85027917 162300785 982109312 134684999 982109312 987323637 -544183345 -500466815 -138314433 -138314433 -37748569 164882322 910934226 910934226 943699025 959230347 413181328 413181328 771798486 959230347 649528598 649528598 959230347 959230347 343224013 -647548627 343224013 535195811 8319566 -735820139 -605747344 -605747344 -605747344 8319566 265736018 535195811 535195811 -344548263 535195811 535195811 535195811 959230347 -198299792 -198299792 -138641524 -600287293 -138641524 170528982 959230347 987323637 384230672 528361624 528361624 822292845 822292845 872771223 401820957 401820957 401820957 433401361 373008270 433401361 433401361 449699907 406497869 44969…

Example 3:

Input: 3114 -817492542 -598396100 240785224 824396494 216713598 884614121 -828637702 705198169 -961580228 -994241025 -74885971 -380973154 -516563389 327842745 -210763169 7196599 -408499253 -672118412 288460502 53392918 501906208 167000157 -566666497 -914235163 307856894 -486753157 222862555 -28751597 -254077856 -317092559 25254163 -805153602 501035327 -171079043 -677320415 528270573 947457187 855608402 454632793 252143740 794841822 833484693 786448933 133487567 785264941 -231163184 223413161 -475387376 -631691908 444213892 -712057885 439507611 206354645 61212034 603866799 -313350037 -675145640 41618852 570237679 -953796612 910382901 212443384 597968907 344260353 -349793398 -349797479 141462141 -791307319 -447726883 -554238538 530398536 28981630 283752696 -504319822 907345843 694716718 895343112 7…
Output: -598396100 240785224 824396494 884614121 884614121 947457187 705198169 947457187 -74885971 -74885971 327842745 327842745 327842745 501906208 7196599 288460502 288460502 288460502 501906208 501906208 528270573 307856894 307856894 307856894 501035327 222862555 501035327 25254163 25254163 25254163 501035327 501035327 528270573 528270573 528270573 947457187 965028847 910382901 794841822 794841822 833484693 910382901 910382901 785264941 910382901 223413161 444213892 444213892 444213892 603866799 439507611 603866799 603866799 603866799 910382901 41618852 41618852 570237679 910382901 910382901 937145927 597968907 907345843 530398536 141462141 141462141 530398536 -447726883 530398536 530398536 907345843 283752696 907345843 907345843 937145927 895343112 937145927 937145927 937145927 965028847 57119…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Wamika and the Taller Ahead - MEDIUM Coding Problem | CodeTikki