CT50588

The Opal Taller Ahead

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Caravans arrive at the northern keep of Frostgate with crates of beacons, and Lata the reckoner 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: 906 120210280 -97812625 967743456 811193116 -203055400 -733106890 643724141 -632452308 -721307594 -580460087 260750380 446388098 -565536609 -512967631 412480441 587807916 937428850 -326188109 562029073 -524301257 -886525893 421388330 -387443924 -588299422 75914870 800629977 -36807470 842204850 87041491 201873187 -123915293 -802350312 -776251371 -568831447 -983574779 141302024 -334020586 -858150198 -952397831 -722711318 160620988 -33701707 -402293546 -309095193 286496387 553565986 76836448 960375486 826218249 -707809620 -348753564 -564234289 -28353887 -534203156 325879122 942026912 734407517 177554191 -486353917 714181819 462799704 -857106602 -316045529 -804423872 635343236 -372337451 200234356 -374050270 -416761957 446679039 403766991 -893213993 870773544 993705174 -318898268 -579047223 -1…
Output: 967743456 967743456 993705174 937428850 643724141 643724141 937428850 -580460087 -580460087 260750380 446388098 587807916 -512967631 412480441 587807916 937428850 960375486 562029073 800629977 421388330 421388330 800629977 75914870 75914870 800629977 842204850 842204850 960375486 201873187 286496387 141302024 -776251371 -568831447 141302024 141302024 160620988 160620988 -722711318 -722711318 160620988 286496387 286496387 -309095193 286496387 553565986 960375486 960375486 993705174 942026912 -348753564 -28353887 -28353887 325879122 325879122 942026912 993705174 870773544 714181819 714181819 870773544 635343236 -316045529 635343236 635343236 870773544 200234356 446679039 446679039 446679039 870773544 870773544 870773544 993705174 996262225 -166491517 -166491517 567887430 582604845 582604845 …

Example 2:

Input: 716 -450784224 444086764 -4771328 -580890244 -585979868 497178574 -830561478 -629364483 -728946395 -605177175 -83949023 922818620 -430473127 197054382 -501558411 286950425 419991999 -823152433 -967139357 186000077 -673346856 649137885 826742571 -890944579 -151718702 989262884 549062482 -808676353 -852023143 334689111 -729855146 155797206 800080757 -493528470 990961991 917083537 -394926542 -261745020 308497081 -735981823 376565006 119163143 -565583340 980527191 153735438 -322060004 991583082 -78644588 -791354933 10952946 -49947663 661426963 841591557 -213246310 -948069151 -177465854 -534714566 321781312 684875495 -830265601 432862272 710928637 950197037 987948254 250923699 937308881 777680602 -172862977 -191371934 42245932 -601222515 288434316 -384227912 209101817 -230956097 129018507 -9541…
Output: 444086764 497178574 497178574 497178574 497178574 922818620 -629364483 -605177175 -605177175 -83949023 922818620 989262884 197054382 286950425 286950425 419991999 649137885 186000077 186000077 649137885 649137885 826742571 989262884 -151718702 989262884 990961991 800080757 334689111 334689111 800080757 155797206 800080757 990961991 990961991 991583082 980527191 -261745020 308497081 376565006 376565006 980527191 980527191 980527191 991583082 991583082 991583082 993245749 10952946 10952946 661426963 661426963 841591557 950197037 -177465854 -177465854 321781312 321781312 684875495 710928637 432862272 710928637 950197037 987948254 993245749 937308881 941885622 941885622 42245932 42245932 288434316 288434316 745816656 209101817 745816656 129018507 745816656 745816656 941885622 355149049 9418856…

Example 3:

Input: 1755 168058263 -974003132 134711483 -88452355 955996566 -257658248 257831575 -474339906 -937573554 611375548 -875845069 840886409 -251969088 420097024 -112590717 -193870967 116711403 -804834799 320227720 -122729680 -548655098 -720219839 -879314403 191354771 64485900 -433268743 -464848898 -673028760 369131257 278507334 504161798 -453311715 -14003775 926339306 75825423 -430777227 -736194632 -396072801 -109033009 637987871 -970067073 -147093037 977565112 260511311 245216671 674716700 -549993018 417501824 461842662 448264935 840271086 -20754505 250698381 -863314688 507277501 425728607 626753841 306047845 -256808108 -323343460 472648891 71590025 -322633562 861210012 378632987 -416396528 70300243 493829635 426128901 -676426914 930995848 351344480 -903991080 -667325700 498313193 -215492695 401746…
Output: 955996566 134711483 955996566 955996566 977565112 257831575 611375548 611375548 611375548 840886409 840886409 926339306 420097024 504161798 116711403 116711403 320227720 320227720 369131257 191354771 191354771 191354771 191354771 369131257 369131257 369131257 369131257 369131257 504161798 504161798 926339306 -14003775 926339306 977565112 637987871 -396072801 -396072801 -109033009 637987871 977565112 -147093037 977565112 993705304 674716700 674716700 840271086 417501824 461842662 840271086 840271086 861210012 250698381 507277501 507277501 626753841 626753841 861210012 472648891 472648891 472648891 861210012 861210012 861210012 930995848 493829635 70300243 493829635 930995848 930995848 930995848 945809166 498313193 -667325700 498313193 690287260 401746387 690287260 945809166 -483721575 -4837…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Opal Taller Ahead - MEDIUM Coding Problem | CodeTikki