CT46231

Quin's Granite marks

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

In the smokehouses of Brineport, Quin the chronicler keeps careful count of the marks. rebuild the damaged itinerary, 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: 2182 -830185143 424341568 -815848214 -133997699 569285102 -620183246 748449304 112062472 715511356 203445438 -457486468 274403187 468935031 159305394 -521803063 923465941 -828466844 686786089 -279337336 -51714214 -721360670 136716719 428121346 437152483 -550436595 -166889018 -699199080 703372640 741020057 809716410 -616944943 -537369244 437333869 -531589145 -20137547 -394591118 721892147 -573701993 -914881442 -206558389 841101979 -701402307 -62328204 -267387611 481648014 -999129702 -536637146 -989531148 496059464 -870382617 456566952 625439115 -122797322 73195233 -715608899 -293002581 -443650539 -885711604 963026773 875554536 -715829272 395369344 -510665764 686085455 333461824 598430175 -842401108 949390489 435623878 294401595 624534636 91564613 -102005263 522736797 -577830468 -581970437 -…
Output: 424341568 569285102 -133997699 569285102 748449304 748449304 923465941 715511356 923465941 274403187 274403187 468935031 923465941 923465941 923465941 963026773 686786089 703372640 -51714214 136716719 136716719 428121346 437152483 703372640 -166889018 703372640 703372640 741020057 809716410 841101979 -537369244 437333869 721892147 -20137547 721892147 721892147 841101979 -206558389 -206558389 841101979 963026773 -62328204 481648014 481648014 496059464 -536637146 496059464 496059464 625439115 456566952 625439115 963026773 73195233 963026773 -293002581 963026773 963026773 963026773 979207289 949390489 395369344 686085455 686085455 949390489 598430175 949390489 949390489 979207289 624534636 624534636 979207289 522736797 522736797 979207289 412937525 412937525 412937525 979207289 -309074367 979…

Example 2:

Input: 1789 -716262467 -702276603 685450008 -441636323 -834743687 -173980216 -794128500 -59692004 743229109 563107015 353404292 -281217695 -740618145 -359697642 -176155233 -346031484 867076496 -731760244 725682854 -263603988 -554619657 -960610294 293009546 389858675 -656632217 498338558 172476707 -677507889 -269465787 -429630805 -966686064 985319393 883877559 566966567 -147432025 -778891325 -926796842 -284690373 896614751 642519087 897642699 4077066 959666948 -409920687 -970876978 -740738934 569617995 152672834 622020234 723965938 -870900202 -855053680 -786991250 864231913 -74228410 763555241 -681158799 -898682386 -389024694 -243073479 -27065270 -812905801 -661483587 410900072 27084069 276132137 661229910 -272981893 135803239 -896955947 985826641 -968459883 405100147 780975337 -571001792 -3114668…
Output: -702276603 685450008 743229109 -173980216 -173980216 -59692004 -59692004 743229109 867076496 867076496 867076496 -176155233 -359697642 -176155233 867076496 867076496 985319393 725682854 985319393 293009546 293009546 293009546 389858675 498338558 498338558 985319393 985319393 -269465787 985319393 985319393 985319393 985826641 896614751 896614751 896614751 -284690373 -284690373 896614751 897642699 897642699 959666948 959666948 985826641 569617995 -740738934 569617995 622020234 622020234 723965938 864231913 -855053680 -786991250 864231913 985826641 763555241 985826641 -389024694 -389024694 -243073479 -27065270 410900072 -661483587 410900072 661229910 276132137 661229910 985826641 135803239 985826641 985826641 999512345 405100147 780975337 898308474 -31146682 183439077 183439077 898308474 9806…

Example 3:

Input: 1911 -426120100 402939898 614996484 -696418550 -741385451 -800108122 -153245063 -872623561 996714994 172630981 271634701 -300987170 419028785 -54490712 141634861 726064740 868952330 -697671236 -144449255 135444110 333188463 -779042781 -448220391 592857126 934307256 -224266099 -291988409 6674567 -110175581 -708447748 29104439 -301694294 -389544447 703205661 94123703 909001781 -561969164 518885636 -216245278 -844011191 -398976100 -482260081 -840759762 -658797848 -968756153 -117510641 -372600626 -95174392 763562845 212600316 -305650106 -71753636 -172641252 378070608 -979393204 793491591 677229850 -148159433 -190739531 -810086635 341314790 -185611010 437067857 227542929 -268567268 -649956328 961821452 -501058476 366930256 183497657 -192638990 667719884 955490335 -386546692 41639590 265333810 -…
Output: 402939898 614996484 996714994 -153245063 -153245063 -153245063 996714994 996714994 997741261 271634701 419028785 419028785 726064740 141634861 726064740 868952330 934307256 -144449255 135444110 333188463 592857126 -448220391 592857126 934307256 961821452 6674567 6674567 29104439 29104439 29104439 703205661 703205661 703205661 909001781 909001781 961821452 518885636 763562845 -117510641 -398976100 -117510641 -117510641 -658797848 -117510641 -117510641 -95174392 -95174392 763562845 793491591 378070608 -71753636 378070608 378070608 793491591 793491591 961821452 961821452 341314790 341314790 341314790 437067857 437067857 961821452 961821452 961821452 961821452 964203322 366930256 667719884 667719884 667719884 955490335 964203322 41639590 265333810 815629873 815629873 815629873 964203322 964203…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Quin's Granite marks - MEDIUM Coding Problem | CodeTikki