CT50008

The Silent signals of Tinker

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

At the clockwork quarter of Gearford, Tinker records each signals in a worn leather ledger. The guild wants answers, not guesses. 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: 915 765259877 667241033 -993031543 714472397 -932738779 -704752887 -660093123 152323076 -883651332 -853053023 -904513380 744801007 -219248143 -479117506 -348926353 223203686 58413767 -882197384 -948479992 768010553 355290002 -147742065 56271781 570001144 -388737630 618227526 484130908 732396215 699747507 319272337 790636324 -609982133 -760593844 548650812 -808619899 434927545 -96292211 284370692 951979938 727516737 -48844608 337948750 740683968 -60294728 117536444 -482416088 -90835008 181928855 874110231 -921857154 -342725072 44056546 -645277089 -718342283 920763234 -643394344 290477098 934691638 644502971 627775266 -196550636 338773148 -259342536 889135736 689053284 -536597189 436073055 932707192 721914058 575234394 798971241 336372274 367045763 -65020730 240399393 324637535 -941605386 78…
Output: 768010553 714472397 714472397 744801007 -704752887 -660093123 152323076 744801007 -853053023 744801007 744801007 768010553 223203686 -348926353 223203686 768010553 768010553 768010553 768010553 790636324 570001144 56271781 570001144 618227526 618227526 732396215 732396215 790636324 790636324 790636324 951979938 548650812 548650812 951979938 434927545 951979938 284370692 951979938 977894235 740683968 337948750 740683968 874110231 117536444 181928855 -90835008 181928855 874110231 920763234 -342725072 44056546 920763234 920763234 920763234 934691638 290477098 934691638 942470316 889135736 889135736 338773148 889135736 889135736 932707192 932707192 436073055 932707192 942470316 798971241 798971241 825636956 367045763 387971481 240399393 324637535 387971481 78104667 387971481 582643339 69263609…

Example 2:

Input: 1186 -186852375 -802991128 709319613 -896085813 -146569833 245448393 833259258 528676803 -860851156 -74998648 -662285120 770747800 -316723539 816311580 -91294985 -184724546 -192207371 -18063534 599477968 -895982319 -889367455 -525038333 678247470 965440313 945889038 -612860415 396613961 -669678366 -298666702 -771056210 -774701699 850282922 -489742058 -996154459 887718368 46534629 -416888906 146585031 -675403177 129323690 -468771326 722598180 -130570306 -242721336 214258012 878752933 463616848 667924934 -361485870 -413052786 -82222166 -610208009 -327825430 755227005 -302085993 -567944413 603560072 788494058 -513197702 759068902 -131271990 -532204676 295749753 807999479 780960925 -189799830 -628070180 295448750 446751243 -591301149 928563569 -783323061 571330435 -834064371 900191255 61505445…
Output: 709319613 709319613 833259258 -146569833 245448393 833259258 965440313 770747800 -74998648 770747800 770747800 816311580 816311580 965440313 -18063534 -18063534 -18063534 599477968 678247470 -889367455 -525038333 678247470 965440313 989938410 963096456 396613961 850282922 -298666702 850282922 850282922 850282922 887718368 887718368 887718368 928563569 146585031 146585031 722598180 129323690 722598180 722598180 878752933 214258012 214258012 878752933 928563569 667924934 755227005 -82222166 -82222166 755227005 -327825430 755227005 788494058 603560072 603560072 788494058 807999479 759068902 807999479 295749753 295749753 807999479 928563569 928563569 295448750 295448750 446751243 928563569 928563569 936986413 571330435 900191255 900191255 910230450 780890707 780890707 910230450 -202373429 6499…

Example 3:

Input: 3328 664307496 -730813899 -38210412 -494300506 -811435743 850216600 -485939418 856343647 72814619 353047419 109689912 166235635 527913561 210766119 -680253764 195089630 293634846 534276842 -397575957 701773709 -53054483 -238024553 -117965633 -774972067 895880534 -324719440 -920627458 149094320 -190561993 -44048757 -30308526 90308333 583185704 421303695 760142467 -702194065 295961053 847702366 129007957 859264541 303059242 353001258 -140724532 -317624786 -611145141 -550406839 198873163 -556983982 238938171 986073999 861037059 -975561609 25057651 985811541 766801441 -941387166 -635778350 -540690267 -547753924 204713152 513937054 727567576 354065618 291988359 252945216 -152415460 820919107 631076235 172431736 -208032992 -245533120 531629763 329493907 -501968330 774947604 106379811 466821490 -…
Output: 850216600 -38210412 850216600 850216600 850216600 856343647 856343647 895880534 353047419 527913561 166235635 527913561 534276842 293634846 195089630 293634846 534276842 701773709 701773709 895880534 895880534 -117965633 895880534 895880534 986073999 149094320 149094320 583185704 -44048757 -30308526 90308333 583185704 760142467 760142467 847702366 295961053 847702366 859264541 859264541 986073999 353001258 986073999 198873163 198873163 -550406839 198873163 238938171 238938171 986073999 998465087 985811541 25057651 985811541 998465087 820919107 -635778350 -540690267 204713152 204713152 513937054 727567576 820919107 820919107 820919107 820919107 820919107 928440298 774947604 531629763 531629763 531629763 774947604 774947604 774947604 928440298 466821490 579475184 127964557 579475184 57947518…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Silent signals of Tinker - MEDIUM Coding Problem | CodeTikki