CT47678

Jessa's Ledger of ledgers

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Every season at the ember dunes of Ashfall, someone must catalog the new acquisitions. This year the task falls to Jessa, armed only with the ledgers 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: 749 303103329 266902945 386020526 108531102 -28662946 -822145761 938279481 -138592043 -634290340 -922568943 335682841 733562691 -950281616 567862545 -802166879 -400404921 -690206008 127264253 83212605 -648359593 87835950 571432008 -685045723 -413627956 -769601394 -708908769 342432905 155281167 488891452 780968554 768743339 -226593947 507453629 21236539 442040905 -2646509 -906452634 -332525438 927794994 991344952 -568100892 152105735 210903520 -244074199 -538953569 -584654326 -629269500 78713675 108587792 -765842071 99021573 638573229 720413590 652409462 -871975329 -398163467 -855622091 715713587 247270299 504473373 534382443 597889607 331119330 -539864379 -455073461 -84462974 924547042 496944525 -808298873 287933189 -890357935 17662909 -159963883 -908649431 -634753518 132855558 -25090958 -…
Output: 386020526 386020526 938279481 938279481 938279481 938279481 991344952 335682841 335682841 335682841 733562691 780968554 567862545 571432008 -400404921 127264253 127264253 571432008 87835950 87835950 571432008 780968554 -413627956 342432905 -708908769 342432905 488891452 488891452 780968554 927794994 927794994 507453629 927794994 442040905 927794994 927794994 -332525438 927794994 991344952 998730524 152105735 210903520 638573229 78713675 78713675 78713675 78713675 108587792 638573229 99021573 638573229 720413590 924547042 715713587 -398163467 715713587 715713587 924547042 504473373 534382443 597889607 924547042 924547042 -455073461 -84462974 924547042 998730524 858772500 287933189 858772500 17662909 132855558 132855558 -634753518 132855558 858772500 858772500 858772500 858772500 887624596 6…

Example 2:

Input: 375 -945647372 634533119 -534725071 82731821 437302153 -845931506 -268444300 297063735 743537467 419420690 35277186 -439668617 -428597851 409438519 -468798016 816985702 426610960 -438488424 -972051815 88616467 -199620720 -395922387 151499838 -129055284 -655204247 557513244 -874417484 701702675 171533698 -202944756 -65398121 805379752 595027227 311570349 -668463504 183107728 -584525262 916462846 -494764235 -38126767 -504056348 -771653078 -112774290 973941589 -878384419 -623656350 -923545753 -927233611 -153871370 -592039229 652206319 -499642892 -213714047 883095285 410859140 632237537 -946369607 335127087 5829607 -859793299 265195235 -1972460 984406184 804209168 -803244456 -148183905 654315995 225428985 994691850 -195460320 -176594771 796926487 -144929156 944303374 -656162690 232014756 53919…
Output: 634533119 743537467 82731821 437302153 743537467 -268444300 297063735 743537467 816985702 816985702 409438519 -428597851 409438519 816985702 816985702 916462846 557513244 88616467 88616467 151499838 151499838 151499838 557513244 557513244 557513244 701702675 701702675 805379752 805379752 -65398121 805379752 916462846 916462846 916462846 183107728 916462846 916462846 973941589 -38126767 973941589 -112774290 -112774290 973941589 984406184 -623656350 -153871370 -153871370 -153871370 652206319 652206319 883095285 -213714047 883095285 984406184 632237537 984406184 335127087 984406184 265195235 265195235 984406184 984406184 994691850 994691850 -148183905 654315995 994691850 994691850 -1 -176594771 796926487 944303374 944303374 960756461 232014756 539191381 666173458 317717900 -207136218 -4234105…

Example 3:

Input: 3225 843049830 676252854 -122721035 -440397366 -322056940 280726073 -931174057 -347357136 29643279 56205158 437435347 627069062 -568598418 504723790 -890361342 -626078043 -964490368 -249850143 -998945840 953583851 919543173 323073029 -582597086 124509519 -868133106 302978180 -516153846 570877565 290310542 602102798 119742949 183578337 173577576 86007502 993035138 70950634 374811587 -59055965 37238847 -430882958 534713471 -317501412 -800576585 -723066162 365585469 247045000 905540251 928288287 -969767242 -342783065 491041023 547335187 -76344783 -96853678 -34669988 -841249425 -285509582 -845839044 -554607135 -371564390 451284856 114024097 486053217 820817212 -872522877 499912339 -850808071 -316772911 932206780 -398554951 -330043991 201849935 -495672071 304384563 -346879834 358528049 -4130919…
Output: 953583851 953583851 280726073 -322056940 280726073 437435347 -347357136 29643279 56205158 437435347 627069062 953583851 504723790 953583851 -626078043 -249850143 -249850143 953583851 953583851 993035138 993035138 570877565 124509519 302978180 302978180 570877565 570877565 602102798 602102798 993035138 183578337 993035138 993035138 993035138 997752035 374811587 534713471 37238847 534713471 534713471 905540251 365585469 -723066162 365585469 905540251 905540251 928288287 932206780 -342783065 491041023 547335187 820817212 -34669988 -34669988 451284856 -285509582 451284856 -554607135 -371564390 451284856 486053217 486053217 820817212 932206780 499912339 932206780 -316772911 932206780 976572680 -330043991 201849935 304384563 304384563 358528049 358528049 540969395 -276974881 -226447352 -22644735…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.