CT36653

The Taller Ahead Beneath Gusthaven

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Morning light hits the windmill fields of Gusthaven as Potter 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: 1153 -652231204 273196749 445095607 -804591127 -210265024 -543534238 818093346 566244587 911182934 212790179 -659375196 65719950 -706556992 -751900970 480948590 156352568 -922120980 -75899275 72039616 510436940 901031721 279592217 -513141967 234075358 502203522 -647738041 993150724 -102527508 -644803693 250762621 -713088847 666642988 -979682269 937214933 922330403 282084490 741620131 764982780 221656940 675653597 948377811 -277106801 436642201 209430528 367096892 81583163 -479855049 923793825 674514456 606736552 -66298958 -212460594 87128179 -132339993 975576462 -250487404 634048700 -606694674 511121142 166147675 -412579592 -187019349 -329058675 698841319 -601718999 -430563844 -836103194 998107859 325294617 -658017859 682386815 459030008 579210361 -850462606 -906303513 775701830 908409234 …
Output: 273196749 445095607 818093346 -210265024 818093346 818093346 911182934 911182934 993150724 480948590 65719950 480948590 480948590 480948590 510436940 510436940 -75899275 72039616 510436940 901031721 993150724 502203522 234075358 502203522 993150724 993150724 998107859 250762621 250762621 666642988 666642988 937214933 937214933 948377811 948377811 741620131 764982780 948377811 675653597 948377811 975576462 436642201 923793825 367096892 923793825 923793825 923793825 975576462 975576462 975576462 87128179 87128179 975576462 975576462 998107859 634048700 698841319 511121142 698841319 698841319 -187019349 698841319 698841319 998107859 -430563844 998107859 998107859 999910406 682386815 682386815 775701830 579210361 775701830 775701830 775701830 908409234 963973277 963973277 67285206 963973277 99…

Example 2:

Input: 1868 -235836706 749057286 297903283 -637896367 411623569 -175348455 35608703 -702789413 -364745816 -577569777 201064605 598669129 510074152 674195989 -184406740 -232097364 -420864553 719521259 821091955 -426342648 -795170078 -246252413 382979474 413278043 196937665 -603649179 -959177032 38848182 -188565085 983728237 -191293116 226295043 -441187199 -847115200 -725889951 -775475368 -143526102 20987666 722359227 598193311 450765666 25959301 -881140380 673307516 -866665899 -423692430 961310071 -959673208 -733687090 -853402052 69070155 -935972547 894156490 -707103611 84513299 -233669139 537146570 -847441357 -652898764 918177075 -999440173 -880371266 483835686 -981174498 -179912103 -307432948 -791522513 -286714040 673877810 661491631 -915505190 208150382 213130645 -805434381 -360098842 -26052427…
Output: 749057286 821091955 411623569 411623569 598669129 35608703 201064605 -364745816 201064605 201064605 598669129 674195989 674195989 719521259 719521259 719521259 719521259 821091955 983728237 -246252413 -246252413 382979474 413278043 983728237 983728237 38848182 38848182 983728237 983728237 993485627 226295043 722359227 -143526102 -725889951 -143526102 -143526102 20987666 722359227 961310071 673307516 673307516 673307516 673307516 961310071 -423692430 961310071 993485627 -733687090 69070155 69070155 894156490 894156490 918177075 84513299 537146570 537146570 918177075 -652898764 918177075 993485627 -880371266 483835686 673877810 -179912103 673877810 -286714040 -286714040 673877810 993485627 993485627 208150382 213130645 470555236 -360098842 -260524278 143475886 143475886 470555236 -230338309 …

Example 3:

Input: 1185 -215904293 676583590 645680279 -596188677 706051568 -179811324 -455685946 962549345 519893797 -154352654 -628539386 352614676 -406639573 698515878 569492538 730013466 159801148 -770384126 -729950821 -405190888 -925204368 798320793 290371606 -726100647 291609479 -659566022 -421373505 233571143 720545272 -354466688 337431396 465742922 -644026436 -618224128 446704236 -78505288 557210028 271536436 709938891 -592327123 493711218 725629746 188596511 -484471803 413346963 169299824 658742463 -148564443 -839703832 191175851 636639190 -721413061 -825229955 335888728 327496088 -468296994 551970955 -220810697 162140843 837452428 121622759 -462907007 810071823 758762379 987443177 619487840 552391678 -350535867 132893966 886931506 178572558 832358384 -76658697 -489333397 -653649212 590033232 512613…
Output: 676583590 706051568 706051568 706051568 962549345 962549345 962549345 987443177 698515878 352614676 352614676 698515878 698515878 730013466 730013466 798320793 798320793 -729950821 -405190888 798320793 798320793 837452428 291609479 291609479 720545272 -421373505 233571143 720545272 725629746 337431396 465742922 557210028 -618224128 446704236 557210028 557210028 709938891 709938891 725629746 493711218 725629746 837452428 413346963 413346963 658742463 658742463 837452428 191175851 191175851 636639190 837452428 335888728 335888728 551970955 551970955 551970955 837452428 162140843 837452428 987443177 810071823 810071823 987443177 987443177 997808935 886931506 886931506 132893966 886931506 922628883 832358384 922628883 590033232 590033232 590033232 922628883 922628883 -218148724 922628883 94977…

Constraints:

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

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