CT41904

The Taller Ahead of Bloomglass

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Sable found an old ledger of ledgers in the greenhouse attic at the orchid house of Bloomglass. The margin notes pose a precise question. 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: 2219 -173387211 231078345 -972796452 -353877882 220157391 670313837 -72622392 -288514098 908166342 71866457 524700041 947367629 -977228520 552012910 -923063993 -942517318 879540775 236185331 -866728012 350316364 657849563 -231172382 -981610208 801377839 -268301712 -82891417 630936945 653173080 561175898 985843807 -896122117 197263789 -309108474 -317055540 -474216924 658149338 -110348718 858059632 -617379933 188515183 550271330 -238029621 379515085 345308278 749180001 -137996028 813747687 331437256 954105020 184181696 -129225020 -831903752 182677898 142086941 690721403 336979348 713634764 -922696392 -189695200 39931296 769723529 561643065 -233498581 80098503 829787354 -486903329 560554046 149725261 -444681908 849595408 -75047630 -668135352 943812233 -859556785 472100246 110963512 -470178599…
Output: 231078345 670313837 -353877882 220157391 670313837 908166342 908166342 908166342 947367629 524700041 947367629 985843807 552012910 879540775 879540775 879540775 985843807 350316364 350316364 657849563 801377839 801377839 801377839 985843807 -82891417 630936945 653173080 985843807 985843807 998661615 197263789 658149338 658149338 658149338 658149338 858059632 858059632 954105020 188515183 550271330 749180001 379515085 749180001 749180001 813747687 813747687 954105020 954105020 965136958 690721403 182677898 182677898 690721403 690721403 713634764 713634764 769723529 -189695200 39931296 769723529 829787354 829787354 80098503 829787354 849595408 560554046 849595408 849595408 849595408 943812233 943812233 943812233 965136958 472100246 523287905 249672988 249672988 421456968 523287905 894568237 …

Example 2:

Input: 1490 -442691044 -734994411 665083672 136273459 -646219947 284411249 -276461669 -233221524 -960334968 206891278 -441525123 -429671481 -653353055 816315342 -290463483 179060795 -813264585 292222784 -780863568 -503852744 -551275977 -587012317 310797056 -52798757 857836371 -992026372 743995223 -51499607 322260653 -170440770 436076240 -136576402 -408720463 -692368044 -223019637 -854602298 -264100887 -218395297 855554654 -876886453 -5395367 505834209 -883151252 -850857436 297457701 -640158477 894695455 766721774 156891727 -760282591 -164975551 57101466 841045663 -615792368 -93177085 11361766 -999213716 -38838998 372517534 -130990073 691721149 -183475338 -890405729 -543808480 -543618236 121402973 -291781360 -936317162 -661044450 311527578 -166240608 216881454 58291010 254425992 -388840542 -369340…
Output: 665083672 665083672 816315342 284411249 284411249 816315342 -233221524 206891278 206891278 816315342 -429671481 816315342 816315342 857836371 179060795 292222784 292222784 310797056 -503852744 310797056 310797056 310797056 857836371 857836371 894695455 743995223 855554654 322260653 436076240 436076240 855554654 855554654 -223019637 -223019637 -218395297 -264100887 -218395297 855554654 894695455 -5395367 505834209 894695455 -850857436 297457701 894695455 894695455 996382106 841045663 841045663 -164975551 57101466 841045663 996382106 -93177085 11361766 372517534 -38838998 372517534 691721149 691721149 996382106 121402973 -543808480 -543618236 121402973 311527578 311527578 -661044450 311527578 996382106 216881454 254425992 254425992 996382106 -369340545 996382106 996382106 998461911 989382414…

Example 3:

Input: 2762 -28362889 -485026125 -861673970 606846187 -898842901 -259509958 680912597 -356688244 -319620655 -560394084 394560275 177624047 327818959 -571368683 -373163799 -726911547 640267561 -978117265 -700233457 -946594246 692043135 -814142107 -749969151 -860504266 259045464 892478475 -409055554 584167490 821143972 305602370 -181348071 826390834 590135985 -416099518 381032592 40716647 -479653580 -81474656 766160601 903628942 600816518 -331341447 -395957493 879666136 835395619 820750658 -943322858 -979622197 853329025 277289950 8834731 858245768 957620541 -166641812 -753990835 -6869235 -148004481 546529855 -743340970 -889837980 -256266546 756148839 909587816 -387409396 429578104 480263055 -245121718 889050164 -638390173 -43486120 -598296463 -719214426 774290240 -451304067 64756716 722617947 -198…
Output: 606846187 606846187 606846187 680912597 -259509958 680912597 692043135 -319620655 394560275 394560275 640267561 327818959 640267561 -373163799 640267561 640267561 692043135 -700233457 692043135 692043135 892478475 -749969151 259045464 259045464 892478475 903628942 584167490 821143972 826390834 826390834 826390834 903628942 766160601 381032592 766160601 766160601 -81474656 766160601 903628942 957620541 879666136 879666136 879666136 957620541 853329025 853329025 853329025 853329025 858245768 858245768 858245768 957620541 971918714 -6869235 -6869235 546529855 546529855 756148839 -256266546 -256266546 756148839 909587816 937542195 429578104 480263055 889050164 889050164 897506885 -43486120 774290240 774290240 774290240 897506885 64756716 722617947 897506885 590722080 897506885 897506885 897506…

Constraints:

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

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