CT53211

The Ashen ledgers of Corwin

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

In the cedar groves of Balmcrest, Corwin the log keeper keeps careful count of the ledgers. reconcile two mismatched ledgers, every figure matters. 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: 1135 99408234 -629822884 -842445639 -338235447 -102881975 743277778 633566480 228140728 254601587 312051429 -804291524 -999434238 549959350 572062741 -465298687 45840979 -835726983 -778877869 -385633464 724463461 -524118654 168969126 897459627 -911038638 401869360 160853568 324384441 860331434 -450761263 5457965 20943982 529877634 -880017689 -484924863 -419352446 778971550 665738302 -386690586 -873035982 13444953 709160245 -848167181 113072518 342368895 -820060978 611571061 252744268 861488034 377712455 916742617 673854613 -747077820 694039202 720275657 393545622 362114798 53487334 932945778 -367912452 -838725061 689241430 351761198 -99463402 -775771700 374580187 -679305687 437629026 -866294931 603312461 -939895046 -638236114 138237050 -215676653 -201917939 668235975 -563754307 453115648 1…
Output: 743277778 -338235447 -338235447 -102881975 743277778 897459627 724463461 254601587 312051429 549959350 549959350 549959350 572062741 724463461 45840979 724463461 -778877869 -385633464 724463461 897459627 168969126 897459627 916742617 401869360 860331434 324384441 860331434 861488034 5457965 20943982 529877634 778971550 -484924863 -419352446 778971550 861488034 709160245 13444953 13444953 709160245 861488034 113072518 342368895 611571061 611571061 861488034 861488034 916742617 916742617 932945778 694039202 694039202 720275657 932945778 932945778 932945778 932945778 974042737 689241430 689241430 974042737 374580187 374580187 374580187 437629026 437629026 603312461 603312461 668235975 -638236114 138237050 668235975 -201917939 668235975 974042737 453115648 974042737 412728608 -79208043 -380794…

Example 2:

Input: 3904 -255394383 476083350 -403417214 -889233430 36757209 -499557083 255540130 885191053 775546051 -471215540 951013438 -550677670 -61971420 203092879 693932559 -197064383 -540659068 428388601 886663295 562553908 408824517 423354575 -954323863 -641165965 826748936 788019336 464119774 283405117 -70206963 -428707829 699795528 409841562 -615921446 -739825477 70339783 -679498015 -353179828 -180458924 -530850531 852197432 -371921444 -804984069 -623759503 926860100 -218463022 -257001804 976829592 720805450 -855360222 676404929 -232844128 276839452 57183238 317586797 -73201766 -578082254 -116627249 -940451689 299115146 958227932 -916506627 512801343 694496872 -371345462 -79633638 927889237 -52519171 316184150 -80716945 -499241654 -689429264 -289346722 -723371933 -549688195 -610646527 285874189 240…
Output: 476083350 885191053 36757209 36757209 255540130 255540130 885191053 951013438 951013438 951013438 976829592 -61971420 203092879 693932559 886663295 428388601 428388601 886663295 926860100 826748936 423354575 826748936 -641165965 826748936 852197432 852197432 699795528 699795528 699795528 699795528 852197432 852197432 70339783 70339783 852197432 -353179828 -180458924 852197432 852197432 926860100 926860100 -623759503 926860100 976829592 976829592 976829592 987433372 958227932 676404929 958227932 276839452 317586797 317586797 958227932 299115146 -116627249 299115146 299115146 958227932 965078861 512801343 694496872 927889237 -79633638 927889237 965078861 316184150 805965830 285874189 -289346722 -289346722 285874189 -549688195 285874189 285874189 805965830 805965830 965078861 330230492 965078…

Example 3:

Input: 2040 82074094 -760384103 64523102 417655503 404211614 -189563604 72134175 630623337 -162366135 -596175005 -434362915 -50922078 625123540 97884437 238595614 472914860 862674561 994175121 541240666 16080432 143789967 -840547987 135479614 -920725779 400700486 397466189 536487040 839275324 23048452 -265982301 743115908 362807163 910581119 -179748476 -934947780 -91099916 -546860815 342367140 112128670 -984919552 64128240 -996653200 277482924 -930774419 -736215576 -481439177 -921624216 -810076901 -730121765 160765552 412225440 -507720662 541961832 594648936 937747599 87594665 644546287 -389539078 -227032507 -463799189 725682193 921246234 253376281 637738402 487429896 -426278741 -600378005 -333179885 244871747 -147825891 -562323041 175422845 -132329166 -696331138 -110103404 -456398107 222956616 -…
Output: 417655503 64523102 417655503 630623337 630623337 72134175 630623337 862674561 -50922078 -434362915 -50922078 625123540 862674561 238595614 472914860 862674561 994175121 995922157 839275324 143789967 400700486 135479614 400700486 400700486 536487040 536487040 839275324 910581119 743115908 743115908 910581119 910581119 937747599 -91099916 -91099916 342367140 342367140 412225440 277482924 64128240 277482924 277482924 412225440 -736215576 -481439177 160765552 -810076901 -730121765 160765552 412225440 541961832 541961832 594648936 937747599 995922157 644546287 725682193 -227032507 725682193 725682193 921246234 995922157 637738402 761409686 761409686 -333179885 -333179885 244871747 369176286 175422845 175422845 222956616 -110103404 -110103404 222956616 222956616 244758879 -148536303 244758879 -7…

Constraints:

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

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