CT55665

The Taller Ahead of Screech Point

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The harbor bell rings at the gull cliffs of Screech Point; Mina weighs the day's ledgers manifests and starts the calculations. 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: 2834 -227478230 -639470786 -726969499 439287827 -541124532 216693375 552317616 785766168 155630532 -183414998 130478435 95112658 643016514 -684099980 -836945738 -558869177 568155691 21167381 405195519 -350774892 41125686 215330176 -310427026 684990345 -383481186 -282876714 625285258 295839952 -419779005 -981270611 15520255 -256696718 271759019 -499588650 -895860313 -133536056 -520835969 -464613305 -681913659 -62104505 443658876 -42321735 872315568 636845965 -744823459 -232692956 486268712 979793634 666616266 400984581 734248217 -659597121 -730030862 957584004 -248367724 988558019 272925754 802162501 875269254 168797463 590458555 -810010663 529543363 -640425750 920706331 -403259132 -923725599 291986366 -817587729 -996024511 -448216104 -567846223 782033626 -540452832 981878075 -837111404 -57…
Output: 439287827 439287827 439287827 552317616 216693375 552317616 785766168 872315568 643016514 130478435 643016514 643016514 684990345 -558869177 -558869177 568155691 684990345 405195519 684990345 41125686 215330176 684990345 684990345 872315568 -282876714 625285258 872315568 443658876 15520255 15520255 271759019 271759019 443658876 -133536056 -133536056 -62104505 -464613305 -62104505 -62104505 443658876 872315568 872315568 979793634 979793634 -232692956 486268712 979793634 988558019 734248217 734248217 957584004 957584004 957584004 988558019 988558019 993766731 802162501 875269254 920706331 590458555 920706331 529543363 920706331 920706331 981878075 291986366 291986366 782033626 -448216104 -448216104 782033626 782033626 981878075 981878075 993766731 -570481535 847681292 886489378 -661854669 22…

Example 2:

Input: 2896 -203916086 632717756 852901210 -917707289 347154354 -306185667 96669256 801901263 501871607 432046951 -307214733 200730271 -40408503 -297491220 392084174 -424644231 -962678638 -407155843 -97406627 298547939 349014356 167375411 -704477733 65218534 -704047433 -411846923 444158005 -134780320 638577149 314379053 -900565657 -867008108 682174470 -267713602 -666172640 -550903475 705712030 -364325914 -229836142 599065532 -991539902 -534682023 -392273694 468490130 -853362170 910283225 -344387823 388068362 -601936590 639177535 294247979 219050937 -822025381 -612180404 -469402317 -618096478 763798308 -11608894 -501118324 277855490 -127448361 -743318556 599475148 932200917 123610031 306226562 -916147093 -713591128 486811390 744903211 582835647 726204158 146003227 591025173 -432119470 -245325321 3…
Output: 632717756 852901210 910283225 347154354 801901263 96669256 801901263 910283225 638577149 444158005 200730271 392084174 392084174 392084174 444158005 -407155843 -407155843 -97406627 298547939 349014356 444158005 444158005 65218534 444158005 -411846923 444158005 638577149 638577149 682174470 682174470 -867008108 682174470 705712030 705712030 -550903475 705712030 910283225 -229836142 599065532 910283225 -534682023 -392273694 468490130 910283225 910283225 932200917 388068362 639177535 639177535 763798308 763798308 763798308 -612180404 -469402317 763798308 763798308 932200917 277855490 277855490 599475148 599475148 599475148 932200917 965975076 306226562 486811390 -713591128 486811390 744903211 965975076 726204158 965975076 591025173 697827767 -245325321 302450788 573906402 697827767 697827767 …

Example 3:

Input: 3270 487902177 833684498 666197240 -674356948 -183642963 259841230 -768658778 -447875211 -902958033 -273932672 342321898 405664944 794231077 363486724 955249097 -927998156 751446193 713226440 365819666 879320322 113114567 990354489 747765167 451496257 277377878 17129812 725428091 -505008862 52671051 -752660182 -53073769 210314647 -770417501 -518122150 -976021819 438610403 -14047431 -811744344 -580828905 183205144 107930857 674264930 976167256 675910565 58719048 -328478706 -913054376 -729367468 814004013 -193980431 340931874 -572504832 389472621 900969884 469823627 -435974984 43706521 -40342780 853128537 673801163 -834916253 99475230 -476796295 831907586 634578965 682513441 222796441 79087273 -916020040 705646632 596323827 7434698 -627357532 -743500477 -158595315 195395316 550947045 -940882…
Output: 833684498 955249097 794231077 -183642963 259841230 342321898 -447875211 -273932672 -273932672 342321898 405664944 794231077 955249097 955249097 990354489 751446193 879320322 879320322 879320322 990354489 990354489 992335136 976167256 725428091 725428091 725428091 976167256 52671051 210314647 -53073769 210314647 438610403 -518122150 438610403 438610403 674264930 183205144 -580828905 183205144 674264930 674264930 976167256 992335136 814004013 814004013 814004013 -729367468 814004013 900969884 340931874 389472621 389472621 900969884 992335136 853128537 43706521 853128537 853128537 992335136 831907586 99475230 831907586 831907586 992335136 682513441 705646632 705646632 705646632 705646632 992335136 992335136 195395316 -158595315 -158595315 195395316 550947045 992335136 -563149914 97200517 9720…

Constraints:

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

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