CT52935

Last registers of Parth

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

In the foggy moor of Greyfen, Parth the surveyor keeps careful count of the registers. Prepare the winter inventory, 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: 6 603584760 -673074967 -199616418 -594794313 259163902 -956597361
Output: -1 -199616418 259163902 259163902 -1 -1

Example 2:

Input: 2623 470545544 -353059941 176829952 -965855614 -149434803 492660330 -443275093 -56528737 408779900 29565234 59535499 -819333603 318872516 -202812786 -693847021 -870028040 744015460 193004418 -775989840 426192897 -302109090 -746973827 505870222 -905411512 -137239845 710189660 962874477 -257219680 -604519411 -404680671 -196514916 142991415 -440639371 -100499891 375743414 313002409 546596808 702751735 191029643 -790669200 -590505786 -976476885 964790895 121326561 -253305897 731884459 146058936 -470672012 435480045 -706223710 -461120519 -780429887 -798793098 -227236813 -359588187 854704758 42822357 621942778 -36837624 302551931 149412973 -639356226 227248096 -8105256 -391385196 526372605 -567791669 -276689904 -695479431 -558186335 941633652 -683670254 282557374 -782034170 94106816 -728251617 -…
Output: 492660330 176829952 492660330 -149434803 492660330 744015460 -56528737 408779900 744015460 59535499 318872516 318872516 744015460 744015460 744015460 744015460 962874477 426192897 426192897 505870222 505870222 505870222 710189660 -137239845 710189660 962874477 964790895 -196514916 -404680671 -196514916 142991415 375743414 -100499891 375743414 546596808 546596808 702751735 964790895 964790895 -590505786 964790895 964790895 965379250 731884459 731884459 854704758 435480045 435480045 854704758 -461120519 -227236813 -227236813 -227236813 854704758 854704758 941633652 621942778 941633652 302551931 526372605 227248096 227248096 526372605 526372605 526372605 941633652 -276689904 941633652 -558186335 941633652 965379250 282557374 739268044 94106816 739268044 -588399839 -524676760 -296357147 -19797…

Example 3:

Input: 1741 940824910 866030384 -51969272 -969011312 292448929 -928829551 -901554781 556053596 447232112 686991111 -557708988 -381199725 167206808 969441831 683881992 658430391 994863562 523381065 -747389034 560308274 30046806 842427585 -186285437 706553745 93117346 175590758 -140165211 -444485616 -666103921 890297944 -182351567 679797371 85818592 -494082634 389563618 59032891 790543603 238485409 198425959 -351604371 1461648 466978078 166112783 -450138007 -204109107 -821178496 667103040 -644327286 -65221649 -841111090 849750574 202350498 349637528 -10067676 -70542067 -470260567 264956501 -702452464 658938118 958821448 900023552 341298767 115442918 -307157135 341348193 485431674 -165353195 -976013170 109250010 919049376 -95486767 -825215579 -959112366 890598181 822985836 -258566443 508745688 11183…
Output: 969441831 969441831 292448929 292448929 556053596 -901554781 556053596 686991111 686991111 969441831 -381199725 167206808 969441831 994863562 994863562 994863562 994982420 560308274 560308274 842427585 842427585 890297944 706553745 890297944 175590758 890297944 890297944 890297944 890297944 958821448 679797371 790543603 389563618 389563618 790543603 790543603 849750574 466978078 466978078 1461648 466978078 667103040 667103040 -204109107 667103040 667103040 849750574 -65221649 849750574 849750574 958821448 349637528 658938118 264956501 264956501 264956501 658938118 658938118 958821448 987792465 919049376 341348193 341348193 341348193 485431674 919049376 109250010 109250010 919049376 987792465 890598181 890598181 890598181 987792465 833989040 508745688 632967858 632967858 779367281 -17907662…

Constraints:

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

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