CT46343

The Taller Ahead Beneath Keelwind

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

It is audit day at the shipyard of Keelwind. Admiral spreads the signals 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: 690 781473433 -231125269 -755047316 808222947 -12508599 707921075 -893395315 441377192 -215707327 -670084629 -586389741 882334455 -903266162 -605956436 269581089 942893302 -863033993 346495637 -820450929 66047371 -71550376 140127526 -666939256 886580762 883014290 156748030 -971995214 452737126 432778196 -849606453 617441293 338195985 -250287378 -765704149 -765331016 -783865508 -155255310 999949390 459880619 926854658 -227902461 245023112 571788082 -446287652 -525795324 -404555279 -619007889 120019434 -60484083 -785722004 -649631897 -101225368 -211219496 -934699165 -854807219 -506364576 798703649 -540727577 225311514 -572969576 787366074 -424081362 415892932 -371606684 -791741176 -225839761 939453232 -806979234 -485786007 -697398138 775585350 -532121178 297883185 -426812160 -708662257 34595…
Output: 808222947 808222947 808222947 882334455 707921075 882334455 441377192 882334455 882334455 -586389741 882334455 942893302 -605956436 269581089 942893302 999949390 346495637 886580762 66047371 140127526 140127526 886580762 886580762 999949390 999949390 452737126 452737126 617441293 617441293 617441293 999949390 999949390 -155255310 -765331016 -155255310 -155255310 999949390 -1 926854658 939453232 245023112 571788082 798703649 -404555279 -404555279 120019434 120019434 798703649 798703649 -649631897 -101225368 798703649 798703649 -854807219 -506364576 798703649 939453232 225311514 787366074 787366074 939453232 415892932 939453232 -225839761 -225839761 939453232 948747806 -485786007 775585350 775585350 883879789 297883185 345950201 345950201 345950201 472420648 472420648 883879789 883879789 883…

Example 2:

Input: 2681 990684809 590807870 815451132 -50565555 -906835652 -278096409 875224839 -456823094 775803962 567698445 -990584430 725554046 215058984 538628085 781383085 846041380 877911559 -409106896 -37267478 -874946405 361336308 466885890 825487222 848633429 -953751719 536334580 -553555852 906658904 -323793913 -260417304 149211558 363645817 406778474 622689386 -436886232 295069460 397216133 -594161361 658945328 763527635 64355717 165030954 163773037 366651535 780594878 962617153 285462914 -345764920 -388772467 -373583812 -868683787 -693080394 320122739 -108866844 -101611769 -493034488 313189400 878851522 244118404 261956752 954146505 -246083150 -691319753 705957086 252649490 -677662041 860305295 587195265 505518186 -613587018 -305487329 464586525 -97625175 -312791877 571424108 -36087467 573568530 …
Output: 995599282 815451132 875224839 875224839 -278096409 875224839 877911559 775803962 781383085 725554046 725554046 781383085 538628085 781383085 846041380 877911559 906658904 -37267478 361336308 361336308 466885890 825487222 848633429 906658904 536334580 906658904 906658904 962617153 -260417304 149211558 363645817 406778474 622689386 658945328 295069460 397216133 658945328 658945328 763527635 780594878 165030954 366651535 366651535 780594878 962617153 963962342 320122739 320122739 -373583812 320122739 -693080394 320122739 878851522 -101611769 313189400 313189400 878851522 954146505 261956752 954146505 963962342 705957086 705957086 860305295 860305295 860305295 963962342 963962342 571424108 -305487329 464586525 571424108 571424108 571424108 573568530 573568530 963962342 963962342 963962342 9639…

Example 3:

Input: 565 -227585575 543379145 -506538827 -573122991 71220433 -617161480 -162417851 -561525382 499878881 792620145 554179516 -696816700 -903514199 -119427773 -815683403 -867774962 880985134 -518234945 -459980003 -360958380 -510777448 715863794 999648633 330573664 495994296 -308396162 -777889032 -297093395 -628707192 -86816549 923042993 -164412540 510631210 251904103 866395728 -156352305 -705974336 258149847 74769810 -629329969 -677571440 225860004 -275113576 -402118907 745089866 934125682 -311311465 -678089845 -343577072 -18512716 -774709974 -179962293 -516694088 191070903 868020167 -781817541 -981087815 900867944 -471498460 37843821 -198344151 883720976 605262500 -570919482 475681413 -305336568 -640926226 -940851334 45238501 757288351 434408682 912219793 -819638750 833340674 -77785777 686954821…
Output: 543379145 792620145 71220433 71220433 499878881 -162417851 499878881 499878881 792620145 880985134 880985134 -119427773 -119427773 880985134 880985134 880985134 999648633 -459980003 -360958380 715863794 715863794 999648633 -1 495994296 923042993 -297093395 -297093395 -86816549 -86816549 923042993 934125682 510631210 866395728 866395728 934125682 258149847 258149847 745089866 225860004 225860004 225860004 745089866 745089866 745089866 934125682 998712890 -18512716 -343577072 -18512716 191070903 -179962293 191070903 191070903 868020167 900867944 900867944 900867944 912219793 37843821 883720976 883720976 912219793 757288351 475681413 757288351 45238501 45238501 45238501 757288351 912219793 912219793 934050741 833340674 934050741 686954821 934050741 -30882950 658736614 934050741 998712890 -519…

Constraints:

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

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