CT43061

Emir's Taller Ahead Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Emir the paymaster watches over the anvil district of Hammerfall's stores of beacons. A careful computation stands between order and chaos. 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: 1258 847701938 -18556771 789827186 916214589 -515494126 187035546 -429693008 -201739340 -335095226 628032629 319960795 -802411307 600096044 958815501 -852539831 -743634003 -849493879 531770192 41605142 -911555644 507293776 3444081 -779475358 737981104 -447625554 561900666 -462119416 -425736468 -869775360 -833065263 887391537 831720893 910895104 833847303 567529928 -358476041 -98121211 -455813445 62932242 73010538 61131812 -488200303 -261354369 819251696 808826237 34857669 9947612 -906743877 444050050 -912710086 -800470507 -345468798 7986411 -237722870 -47444127 711551333 772107904 -408370142 -232658396 996058256 436552698 993429098 -219575385 -3149922 -271915435 749157458 879478749 -903713122 -422775285 -837877878 582121324 310822236 681472618 659098831 80438783 -946453699 -794337332 -1443…
Output: 916214589 789827186 916214589 958815501 187035546 628032629 -201739340 628032629 628032629 958815501 600096044 600096044 958815501 996058256 -743634003 531770192 531770192 737981104 507293776 507293776 737981104 737981104 737981104 887391537 561900666 887391537 -425736468 887391537 -833065263 887391537 910895104 910895104 996058256 996058256 819251696 -98121211 62932242 62932242 73010538 819251696 819251696 -261354369 819251696 996058256 996058256 444050050 444050050 444050050 711551333 -800470507 -345468798 7986411 711551333 -47444127 711551333 772107904 996058256 -232658396 996058256 997700611 993429098 997700611 -3149922 749157458 749157458 879478749 919775058 -422775285 582121324 582121324 681472618 681472618 858826193 858826193 163865411 -794337332 -14433299 163865411 858826193 919775…

Example 2:

Input: 1122 536468582 -424540670 904875691 308258934 194163301 -917542281 -309885002 344248569 704813216 583542057 391355919 153188085 632055598 895711457 -737395338 -946641304 754959236 472540926 934947560 934891028 554324858 -683522379 -334329488 -644462658 606998506 -502994093 -578321554 -529113686 536470696 -672596116 -559606884 890773718 99521338 -370589066 -484956135 -130312074 -909032707 348916223 368126358 530889480 -184528103 865666195 85042411 -36161385 463169459 -41311576 -494403254 71863612 -655467343 774170780 -351971197 740652537 285769181 -629760055 -730108638 -927145628 747397743 115037217 -587365989 520170745 691169116 614905900 -106940676 -283334026 325206952 931904264 -985032253 -995522166 507045680 657572438 601767340 802094677 -977723692 -423887186 281763890 -315920553 263747…
Output: 904875691 904875691 934947560 344248569 344248569 -309885002 344248569 704813216 895711457 632055598 632055598 632055598 895711457 934947560 754959236 754959236 934947560 934947560 963468532 963468532 606998506 -334329488 606998506 606998506 890773718 536470696 -529113686 536470696 890773718 -559606884 890773718 931904264 348916223 -130312074 -130312074 348916223 348916223 368126358 530889480 865666195 865666195 931904264 463169459 463169459 774170780 71863612 71863612 774170780 774170780 931904264 740652537 747397743 747397743 747397743 747397743 747397743 931904264 520170745 520170745 691169116 931904264 931904264 325206952 325206952 931904264 963468532 507045680 507045680 657572438 802094677 802094677 963468532 -423887186 281763890 483122689 263747358 483122689 483122689 963468532 14627…

Example 3:

Input: 127 36385388 -177933271 358896781 -847820829 759936266 51298773 642481771 -117180560 773851427 60318407 249731744 -760125064 197033041 -703489220 380116722 374421827 -56802993 -652340214 877617669 819677919 909580965 -969136455 -395539492 -540808748 -340065365 999560677 -957731633 402532914 380604189 258609629 -578367993 -601071840 329724210 60249119 451506722 866830950 -76526546 -856337383 351391201 741677309 521343572 -662451048 -920577245 -518219134 -732382003 781572873 435430265 -631445230 -701529523 -373112868 -635849842 54456311 -252287556 -265413731 -458992958 431409192 255959907 -831865145 -476063037 -729144622 917351217 -721534430 66528614 605326486 326854596 -48503509 -816039415 -696775062 434656593 -147268613 -333648200 576788519 210972270 -681589681 -804897441 934106320 1744191…
Output: 358896781 358896781 759936266 759936266 773851427 642481771 773851427 773851427 877617669 249731744 380116722 197033041 380116722 380116722 877617669 877617669 877617669 877617669 909580965 909580965 999560677 -395539492 -340065365 -340065365 999560677 -1 402532914 451506722 451506722 329724210 329724210 329724210 451506722 451506722 866830950 917351217 351391201 351391201 741677309 781572873 781572873 -518219134 -518219134 781572873 781572873 917351217 917351217 -373112868 -373112868 54456311 54456311 431409192 431409192 431409192 431409192 917351217 917351217 -476063037 917351217 917351217 934106320 66528614 605326486 934106320 434656593 434656593 -696775062 434656593 576788519 576788519 576788519 934106320 934106320 934106320 934106320 -1 643224428 -79904337 643224428 754928977 75492897…

Constraints:

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

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