CT51049

Mira and the Prismatic registers

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Caravans arrive at the shipyard of Keelwind with crates of registers, and Mira the paymaster 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: 3339 -246524941 -538047476 -849082924 102305506 -148634493 30598193 -704221783 -605736274 371525267 -34690907 -197742223 991182946 -508237053 923842445 521727647 -886474881 235163570 684874999 286086841 388079115 145377648 175418201 -267162082 -93969252 876323207 764500613 -857483728 -595243280 203179650 169500459 532648201 -407987093 312100002 212690336 -267739586 -823869076 782047658 -807193844 -778857093 787536708 -458324710 -544209323 970879335 627369131 -296403465 797536375 -173469109 -870644885 -57616154 594656349 944034398 915277359 -244440097 -244612404 -275139404 -565495077 -788354984 -35719101 510853604 676208242 -855738218 979648203 -502838515 -941347015 890781806 418575642 -443020611 681189981 -838751813 330376135 750581968 129630596 -948910249 -992975066 491974464 425767541 26…
Output: 102305506 102305506 102305506 371525267 30598193 371525267 -605736274 371525267 991182946 991182946 991182946 999348245 923842445 970879335 684874999 235163570 684874999 876323207 388079115 876323207 175418201 876323207 -93969252 876323207 970879335 782047658 -595243280 203179650 532648201 532648201 782047658 312100002 782047658 782047658 782047658 782047658 787536708 -778857093 787536708 970879335 970879335 970879335 979648203 797536375 797536375 944034398 -57616154 -57616154 594656349 944034398 979648203 979648203 -35719101 -35719101 -35719101 -35719101 -35719101 510853604 676208242 979648203 979648203 988350268 890781806 890781806 954889065 681189981 681189981 750581968 330376135 750581968 954889065 491974464 491974464 491974464 578555099 458971172 319170798 319170798 365955813 36595581…

Example 2:

Input: 3365 -799352797 880305886 473828433 99760895 -706943203 -947904679 -922942841 -848967738 -51452840 81267154 250778939 426259594 -253595240 695477658 225975292 289795575 -606163817 823161300 948833749 154174397 -306768779 -406055217 512545617 391222336 -42715209 -456187550 -144909386 720708154 -154893027 -626147108 581858597 -955573740 -268217149 -836531492 -703592561 325833622 991317488 402400034 263562390 323348394 -820643367 -208371868 -974155426 -344929264 269152415 238626030 -473465144 -908105348 -674784128 -822715388 -255571155 -368454523 -440562888 171731876 349321845 892626039 -437795011 587544038 -671547467 17772167 389352641 -425590576 316569814 645821310 794054122 127243955 545262013 582253041 525513541 498296157 -610315210 -424833576 441349396 570660554 -286348703 -528727542 -42…
Output: 880305886 948833749 695477658 250778939 -51452840 -922942841 -848967738 -51452840 81267154 250778939 426259594 695477658 695477658 823161300 289795575 823161300 823161300 948833749 991317488 512545617 512545617 512545617 720708154 720708154 720708154 -144909386 720708154 991317488 581858597 581858597 991317488 -268217149 325833622 -703592561 325833622 991317488 997054344 892626039 323348394 349321845 -208371868 269152415 -344929264 269152415 349321845 349321845 -255571155 -674784128 -255571155 -255571155 171731876 171731876 171731876 349321845 892626039 899670406 587544038 645821310 17772167 389352641 645821310 316569814 645821310 794054122 899670406 545262013 582253041 899670406 570660554 570660554 -424833576 441349396 570660554 573103761 332086251 -420281285 332086251 364286247 504376416…

Example 3:

Input: 1557 509222995 -977903437 -360164010 -64859390 790390800 644143566 771337449 702620459 24339897 -759689168 -431138716 -735767463 649290673 105907324 -936902352 641662552 807306037 880003537 805310315 507327770 516422722 676142896 -389362243 -340336147 -806942510 599822930 46377798 -112740909 981331899 674677891 -640517184 728514634 -394243002 617883752 789513268 -497396874 890473465 286796640 752145860 997753805 -922729896 -355589608 416078526 512578178 -287557596 -825515521 172775885 308089875 -115574548 -330838207 158397162 61716500 22456716 118812848 680150533 493587523 -498756747 -993831481 491920454 -3509542 556763482 511266214 856862683 -698332665 953784402 -322577578 -48141371 -977171101 104043470 768962734 668292147 645854635 930602276 53524801 -869568377 -958719251 918310766 37792…
Output: 790390800 -360164010 -64859390 790390800 807306037 771337449 807306037 807306037 649290673 -431138716 649290673 649290673 807306037 641662552 641662552 807306037 880003537 981331899 981331899 516422722 676142896 981331899 -340336147 599822930 599822930 981331899 981331899 981331899 997753805 728514634 728514634 789513268 617883752 789513268 890473465 890473465 997753805 752145860 997753805 998835121 -355589608 416078526 512578178 680150533 172775885 172775885 308089875 680150533 158397162 158397162 680150533 118812848 118812848 680150533 856862683 556763482 491920454 491920454 556763482 556763482 856862683 856862683 953784402 953784402 989945232 -48141371 104043470 104043470 768962734 930602276 930602276 930602276 989945232 918310766 918310766 918310766 989945232 730459596 837177353 837177…

Constraints:

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

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