CT46504

The Taller Ahead Beneath Chessfield

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

It is audit day at the rook towers of Chessfield. Quartermaster spreads the beacons records across the table and picks up a sharp pencil. 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: 2980 913468624 -973426042 -522653722 -46348844 786978447 -20950153 107924867 -652096798 701641159 463232807 550623925 186913806 -430210046 864989385 562420217 -47011645 -422101106 34135503 -412512104 862077648 -685667079 -286959116 -611766393 189792271 399150501 568322498 144870384 -917486901 949960199 -894324898 -383020746 -217404134 -222076826 -543633743 -517319602 -237665000 38945485 -825896639 130026523 595193501 840051311 60139492 -76073982 186271629 45208533 -641728899 806718098 221099193 991136600 80809175 -130865674 986009696 -675618675 -408344973 -593489568 -4778229 775423481 285377875 -570262838 416090555 -121848855 -965736359 -808821530 875478829 -981131573 -647248527 -707370178 131959537 316855374 347807524 42940975 200443139 -931034662 983173255 -562160743 -192119248 -19973218…
Output: 949960199 -522653722 -46348844 786978447 864989385 107924867 701641159 701641159 864989385 550623925 864989385 864989385 864989385 949960199 862077648 34135503 34135503 862077648 862077648 949960199 -286959116 189792271 189792271 399150501 568322498 949960199 949960199 949960199 991136600 -383020746 -217404134 38945485 38945485 -517319602 -237665000 38945485 130026523 130026523 595193501 840051311 991136600 186271629 186271629 806718098 806718098 806718098 991136600 991136600 991690362 986009696 986009696 991690362 -408344973 -4778229 -4778229 775423481 875478829 416090555 416090555 875478829 875478829 -808821530 875478829 983173255 -647248527 131959537 131959537 316855374 347807524 983173255 200443139 983173255 983173255 991690362 -192119248 -19973218 658704799 685995575 685995575 8537877…

Example 2:

Input: 3681 829939551 694373013 -859205367 122196852 722234734 486402602 50907794 302866392 543291437 -120054506 651991342 -54512740 -98362557 469652149 85470132 -801988843 -382827612 382943301 -945438369 -570917889 -806744250 -176232001 723947938 -344500486 -139263992 -76759435 -538788883 37794380 -42872004 -598513124 -937887534 -579892354 698927871 -300831892 -207832878 112366382 385923682 918278434 845059670 -401940113 492297370 -113358746 -826793683 152364448 -180494533 -764399669 -635856394 153389067 -530365617 -810439612 -618061571 675096702 -168961594 532460594 -629976777 -260558714 321912722 -339745760 954022207 583046850 153740087 -15917919 -970703578 730172659 -288916215 784385618 -849668533 -31480029 943724670 933691527 -548579014 660800973 -209527951 587599729 778341764 -513048613 -84…
Output: 918278434 722234734 122196852 722234734 723947938 543291437 302866392 543291437 651991342 651991342 723947938 469652149 469652149 723947938 382943301 -382827612 382943301 723947938 -570917889 -176232001 -176232001 723947938 918278434 -139263992 -76759435 37794380 37794380 698927871 698927871 -579892354 -579892354 698927871 918278434 -207832878 112366382 385923682 918278434 954022207 954022207 492297370 675096702 152364448 152364448 153389067 153389067 -635856394 153389067 675096702 675096702 -618061571 675096702 954022207 532460594 954022207 -260558714 321912722 954022207 954022207 967681879 730172659 730172659 730172659 730172659 784385618 784385618 943724670 -31480029 943724670 967681879 967681879 660800973 778341764 587599729 778341764 848753584 14837197 14837197 379301201 848753584 870…

Example 3:

Input: 409 153715854 464081010 -618767270 -357912940 -402032403 -311528200 771904017 961069867 848010718 -536360019 -129776398 -229822488 350898110 367572099 968078176 -408041122 657251366 129701359 -92769205 110670507 407155305 -736806153 -61975522 -887518837 -958033416 -779488984 693167897 883535265 -307080410 -206436192 -125234395 331073025 -194903746 283900753 -457563743 316420745 -308173823 778827337 -544896477 -326322655 456546982 508959236 788304402 461655649 -183889122 697340932 858776070 229509981 -104564489 617841766 289766579 648790342 -506039065 -254194743 -599686029 464262794 150523812 594354985 -46604637 292319313 965796268 -974941823 550782090 875565092 -728929383 -751710388 -907137704 -798490283 918576913 -433692095 785273513 -300636255 85299089 -580258461 272191652 -769650692 522…
Output: 464081010 771904017 -357912940 -311528200 -311528200 771904017 961069867 968078176 968078176 -129776398 350898110 350898110 367572099 968078176 986875704 657251366 693167897 407155305 110670507 407155305 693167897 -61975522 693167897 -779488984 -779488984 693167897 883535265 965796268 -206436192 -125234395 331073025 778827337 283900753 316420745 316420745 778827337 778827337 788304402 -326322655 456546982 508959236 788304402 858776070 697340932 697340932 858776070 965796268 617841766 617841766 648790342 648790342 965796268 -254194743 464262794 464262794 594354985 594354985 965796268 292319313 965796268 986875704 550782090 875565092 918576913 918576913 918576913 -798490283 918576913 986875704 785273513 883878955 85299089 272191652 272191652 522376732 522376732 530588224 697188807 883878955 …

Constraints:

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

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