CT35323

Navigator's marks Taller Ahead

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

It is audit day at the crane marshes of Stillwater. Navigator spreads the marks 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: 1489 394311916 -361290004 346619943 192944781 -625855465 -828726769 -555206368 729729882 409808338 290206910 661733071 -330780417 -898555786 966267291 629101105 -329693524 833156870 520088831 -213885756 519957651 103512625 422301320 941761398 -901673780 -964818763 -289330736 863232801 -874855690 68592076 405494762 339208225 906511097 69852054 775928723 -325462069 3501387 -42682032 -669203073 -207907296 -409437923 -106638122 403711980 -453517537 987498683 -485626208 -182447803 766715477 199529401 -340394125 -279012929 -37162632 760595671 793919091 261980477 -826523261 -443571331 705273776 994211345 439302844 -519602991 -192816798 323518596 -312328034 -925130826 448390972 -992430764 -471268615 -504964822 750589174 716566249 736577748 -555118515 483227792 149894808 885258771 -799666480 640962…
Output: 729729882 346619943 729729882 729729882 -555206368 -555206368 729729882 966267291 661733071 661733071 966267291 966267291 966267291 987498683 833156870 833156870 941761398 941761398 519957651 941761398 422301320 941761398 987498683 -289330736 -289330736 863232801 906511097 68592076 405494762 906511097 906511097 987498683 775928723 987498683 3501387 403711980 403711980 -207907296 -106638122 -106638122 403711980 987498683 987498683 994211345 -182447803 766715477 793919091 760595671 -279012929 -37162632 760595671 793919091 994211345 705273776 -443571331 705273776 994211345 995500531 448390972 -192816798 323518596 448390972 448390972 448390972 750589174 -471268615 750589174 750589174 885258771 736577748 885258771 483227792 885258771 885258771 976606659 64096277 794484249 -319887345 794484249 7…

Example 2:

Input: 1896 598562334 273252988 194883970 -65863307 -333313080 286402680 145271557 -421083055 587751963 372887397 -621900041 -230952794 277782613 -281076957 -31834808 -868709291 -277747226 880500769 938734271 758057197 891786708 -116445729 -244741163 168894543 470339154 -280794924 682362 448954943 723279968 -383787260 -627101940 465820808 130266228 -919013483 593955284 -725281793 -587805744 -932858198 -234833952 812230798 -80982829 172276236 -526688874 835373385 482961915 -876445063 713323064 675956755 84575490 -750322549 950671786 570625832 795292638 395777862 -126910225 -926741289 531304035 706724463 -124395372 -285684012 487055698 51940393 -572276574 -161473576 -236533920 -59554924 727834901 820892434 787370494 44006926 -787302063 107963314 549047128 -435295207 -587571315 -912464029 -897956490…
Output: 880500769 286402680 286402680 286402680 286402680 587751963 587751963 587751963 880500769 880500769 -230952794 277782613 880500769 -31834808 880500769 -277747226 880500769 938734271 950671786 891786708 950671786 168894543 168894543 470339154 723279968 682362 448954943 723279968 812230798 465820808 465820808 593955284 593955284 593955284 812230798 -587805744 -234833952 -234833952 812230798 835373385 172276236 835373385 835373385 950671786 713323064 713323064 950671786 950671786 950671786 950671786 974586013 795292638 820892434 531304035 531304035 531304035 706724463 727834901 487055698 487055698 727834901 727834901 -161473576 -59554924 -59554924 727834901 820892434 847211613 847211613 107963314 107963314 549047128 611700982 611700982 611700982 -897956490 611700982 755398495 -349510054 -4255…

Example 3:

Input: 1055 906064254 231198835 991493775 33268988 370299567 -207023103 -10841365 321780534 -201554626 62690290 -894032323 53484646 591795274 -609550288 -548672214 -894155561 -207948116 -642532126 -665904399 343678402 690974086 -127347090 164509596 842958746 882925521 -232178875 -558687268 790090765 7766570 355824057 890818599 744079002 679126652 211643424 848264942 -868136406 225431272 76593922 407828357 595203246 672568885 -60663695 -555206336 -993353123 -610516321 -938861897 -672582702 905643355 -394939448 792677936 -435945889 306795341 471781024 873501217 -189818957 296753958 -131599078 -52019908 -396058958 606908996 841618829 -445858191 775895399 115087529 -661091247 242032374 -36605445 -496592418 166415887 63386724 -346621045 883999139 45065893 -611420468 129940888 861920073 660043325 -3905…
Output: 991493775 991493775 999141912 370299567 591795274 -10841365 321780534 591795274 62690290 591795274 53484646 591795274 690974086 -548672214 -207948116 -207948116 343678402 343678402 343678402 690974086 842958746 164509596 842958746 882925521 890818599 790090765 790090765 890818599 355824057 890818599 905643355 848264942 848264942 848264942 905643355 225431272 407828357 407828357 595203246 672568885 905643355 905643355 905643355 -610516321 905643355 -672582702 905643355 968227732 792677936 873501217 306795341 471781024 873501217 883999139 296753958 606908996 -52019908 606908996 606908996 841618829 883999139 775895399 883999139 242032374 242032374 883999139 166415887 166415887 883999139 883999139 883999139 968227732 129940888 129940888 861920073 968227732 747795390 -10476529 118675030 -634330…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Navigator's marks Taller Ahead - MEDIUM Coding Problem | CodeTikki