CT45977

Lamplighter's registers Taller Ahead

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Every season at the orchard lands of Applerun, someone must plan the beacon maintenance rota. This year the task falls to Lamplighter, 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: 3298 499845143 998014297 -241223899 -587792191 292167807 -55341732 -114240774 410363988 -538726254 -473640014 -489554950 697073817 -523004485 614804385 713356643 -514935714 599235124 521501288 -834390709 -170350859 -688297463 260166873 -749245993 296928606 -357127815 440952115 251425592 -525733455 73960184 -678026864 408474625 -715056656 67745210 -445384038 167049815 377280765 -166366461 -566410860 -716868127 -380214818 -282384714 -738615123 822216181 -866158275 -524457873 179571733 514329628 919595200 994839164 -819475219 -126316405 -509831358 65106141 484189663 357029875 158651487 212210754 -294955882 230323546 -990900422 -443130389 -585063406 -947325599 -128931562 671406836 57471419 528432603 140670197 -541780677 -187431162 542986170 -91286658 797404772 306966885 552901039 630777176 -43…
Output: 998014297 -1 292167807 292167807 410363988 410363988 410363988 697073817 -473640014 697073817 697073817 713356643 614804385 713356643 822216181 599235124 822216181 822216181 -170350859 260166873 260166873 296928606 296928606 440952115 440952115 822216181 408474625 73960184 408474625 408474625 822216181 67745210 167049815 167049815 377280765 822216181 822216181 -380214818 -380214818 -282384714 822216181 822216181 919595200 -524457873 179571733 514329628 919595200 994839164 996403253 -126316405 65106141 65106141 484189663 671406836 671406836 212210754 230323546 230323546 671406836 -443130389 -128931562 -128931562 -128931562 671406836 797404772 528432603 542986170 542986170 -187431162 542986170 797404772 797404772 806785151 552901039 630777176 643160720 -290631856 -290631856 643160720 8067851…

Example 2:

Input: 2074 -182272681 -943941016 84154316 298158859 615604815 -494146403 -240320066 439359611 89843112 355439554 -402680405 576887195 775516689 53508693 -71538420 -195859130 909121358 467000917 -499883292 -397909145 -742109029 -611341492 789899581 29763243 266946437 -730740590 -782792370 915077931 -582827758 132452194 167147174 -356364714 -401290413 -293828098 827520206 181530388 -357510832 523205122 -445261272 782742484 -198133681 517828148 -777114730 848023478 -563757825 -383429304 -327381903 -959131378 -116417534 783702772 298578640 -360074442 -391489811 -315071676 -921150057 955058478 -2894000 -536324261 -539862075 433892707 317651986 -379220668 47429686 -730091439 -789797835 563205346 -594993075 931861013 -477820798 -484860255 -395557759 902078540 253030746 351678420 464857839 677320318 -94…
Output: 84154316 84154316 298158859 615604815 775516689 -240320066 439359611 576887195 355439554 576887195 576887195 775516689 909121358 909121358 909121358 909121358 915077931 789899581 -397909145 789899581 -611341492 789899581 915077931 266946437 915077931 915077931 915077931 955058478 132452194 167147174 827520206 -293828098 -293828098 827520206 848023478 523205122 523205122 782742484 782742484 848023478 517828148 848023478 848023478 955058478 -383429304 -327381903 -116417534 -116417534 783702772 955058478 955058478 -315071676 -315071676 955058478 955058478 965921496 433892707 433892707 433892707 563205346 563205346 47429686 563205346 563205346 563205346 931861013 931861013 954555959 -395557759 -395557759 902078540 954555959 351678420 464857839 677320318 743183078 -404634313 550109136 647642704…

Example 3:

Input: 100 763282312 552142568 946540230 868068414 -130687001 -156806153 -489548205 18589870 -550074159 -816884363 -52684924 -449649635 -422536631 588052257 -346024611 -629595508 -767979406 -303825203 -249340518 -475453381 851863936 -490118395 -732705778 713231019 -304919551 304175469 429523929 -780707927 246081780 688773577 -740727478 125060997 -901277266 917367348 407993859 -955151109 558601952 -357959761 354921718 -922953340 -871314735 -386834238 695641079 893189870 50656490 -81233235 -321283239 -74358361 -546448657 -676003352 965581850 40420875 308742718 -766210623 263643457 611011721 -9391970 -291738049 -932004369 -717262968 -876245756 -382292396 387041608 -522172188 253952960 996976718 539016146 604830972 -863449345 -32198198 -681143143 332942834 -813325674 101984065 -366566656 316731299 12…
Output: 946540230 946540230 965581850 917367348 18589870 18589870 18589870 588052257 -52684924 -52684924 588052257 -422536631 588052257 851863936 -303825203 -303825203 -303825203 -249340518 851863936 851863936 917367348 713231019 713231019 917367348 304175469 429523929 688773577 246081780 688773577 917367348 125060997 917367348 917367348 965581850 558601952 558601952 695641079 354921718 695641079 -871314735 -386834238 695641079 893189870 965581850 965581850 -74358361 -74358361 965581850 965581850 965581850 996976718 308742718 611011721 263643457 611011721 996976718 387041608 387041608 -717262968 -382292396 -382292396 387041608 996976718 253952960 996976718 -1 604830972 900625030 -32198198 332942834 332942834 900625030 101984065 316731299 316731299 900625030 900625030 900625030 935487231 406564750 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Lamplighter's registers Taller Ahead - MEDIUM Coding Problem | CodeTikki