CT52814

Botanist's Ledger of registers

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Caravans arrive at the jade shrine of Serpentis with crates of registers, and Botanist the quartermaster must account for every last one. 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: 2044 101326377 -349671529 -474658956 -771100696 249303806 822970583 -564899966 560005593 -661362000 408544068 -645290739 -622848423 478711671 808570497 -42148169 603395090 527072989 -222576889 -446503500 840905738 -708463311 -247325973 754245182 946921502 -732695230 893017047 226539289 -211221497 -891607067 498983434 -521681420 -197590570 -358653108 -350554205 -21702701 -404405070 328755009 750538408 -512626679 908228081 -23647357 362531369 -664002750 749853391 642802591 141564415 717137312 -128469416 -741912904 116382442 -135342204 987589059 730353836 502246243 185732093 297381561 84855505 -933346138 -618014446 -868240974 -645568236 21825986 475181298 -276148725 -374549068 -160655260 -30138304 813318100 722985235 321498136 311034724 -248110712 -704438118 -70098687 362791146 -431971404 987…
Output: 249303806 249303806 249303806 249303806 822970583 840905738 560005593 808570497 408544068 478711671 -622848423 478711671 808570497 840905738 603395090 840905738 840905738 840905738 840905738 946921502 -247325973 754245182 946921502 987589059 893017047 908228081 498983434 498983434 498983434 750538408 -197590570 -21702701 -350554205 -21702701 328755009 328755009 750538408 908228081 908228081 987589059 362531369 749853391 749853391 987589059 717137312 717137312 987589059 116382442 116382442 987589059 987589059 991669987 813318100 813318100 297381561 475181298 475181298 -618014446 21825986 -645568236 21825986 475181298 813318100 -160655260 -160655260 -30138304 813318100 987068227 987068227 362791146 362791146 -70098687 -70098687 362791146 987068227 987068227 991669987 140577168 623255398 8821…

Example 2:

Input: 2149 -540779162 -899073801 837432259 -164370470 956525465 -117194809 249666408 737507755 782343834 159018474 314509021 -406480227 -57696090 526938360 235852561 570404773 77458851 189536096 141867344 -79915546 439164345 -834769848 -346704961 -218122880 -462632040 657802006 -440344395 373667383 -35193686 -550868571 -352513493 69566761 -608745387 -624976102 887814584 -241863633 183916836 -179639263 -326358748 290765851 -361387305 -464786318 232708498 -895872652 411175846 -220149008 998193276 592697580 -778858096 234064103 878184938 -359984147 -779966172 76731268 -704979044 712339323 298915490 -562920856 686463672 -297554382 247522330 -79534447 -514618820 858272688 243731135 242205453 200332540 254422829 -110418093 -263838714 84795869 86594404 640227773 -361304595 508183282 31171668 217776558 …
Output: 837432259 837432259 956525465 956525465 998193276 249666408 737507755 782343834 887814584 314509021 526938360 -57696090 526938360 570404773 570404773 657802006 189536096 439164345 439164345 439164345 657802006 -346704961 -218122880 657802006 657802006 887814584 373667383 887814584 69566761 -352513493 69566761 887814584 887814584 887814584 998193276 183916836 290765851 290765851 290765851 411175846 232708498 232708498 411175846 411175846 998193276 998193276 -1 878184938 234064103 878184938 988530850 76731268 76731268 712339323 712339323 858272688 686463672 686463672 858272688 247522330 858272688 858272688 858272688 988530850 254422829 254422829 254422829 640227773 84795869 84795869 86594404 640227773 988530850 508183282 988530850 217776558 988530850 997658565 568896224 568896224 811282283 9…

Example 3:

Input: 3092 -125483217 -33198790 -765242354 -769917033 152664184 -478683659 174280691 -119883835 562759987 -232429857 -124476455 447428403 -377712412 395958664 146818022 -529698242 329764334 231346697 -539421054 839114315 -561318932 968113380 -741653273 -140744216 121091603 198191370 -410186396 -371501623 866303599 81844353 -900330275 -563361414 -207710491 988536350 158555813 -847870191 -585748545 -960211044 -657001744 -952749783 869094525 -990240388 160206910 813181906 302943204 58946507 -496313128 530040744 -429642462 569443339 995595130 259755478 900012379 -10039692 105880265 250069617 722334756 53877578 770367414 266571838 -747822615 533854722 284628618 -50621236 -283642005 -233002448 313873662 -709290507 -562300382 730921791 830019194 -45821844 -98480247 867668590 650776528 790073628 9954117…
Output: -33198790 152664184 152664184 152664184 174280691 174280691 562759987 562759987 839114315 -124476455 447428403 839114315 395958664 839114315 329764334 329764334 839114315 839114315 839114315 968113380 968113380 988536350 -140744216 121091603 198191370 866303599 -371501623 866303599 988536350 988536350 -563361414 -207710491 988536350 995595130 869094525 -585748545 869094525 -657001744 869094525 869094525 995595130 160206910 813181906 995595130 530040744 530040744 530040744 569443339 569443339 995595130 995797745 900012379 995411728 105880265 250069617 722334756 770367414 770367414 830019194 533854722 533854722 730921791 313873662 313873662 -233002448 313873662 730921791 -562300382 730921791 830019194 867668590 867668590 867668590 995411728 790073628 995411728 995797745 -300768287 380724396 …

Constraints:

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

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