CT40864

Piper's signals Reckoning

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Piper the reckoner watches over the mining town of Ironvein's stores of signals. A careful computation stands between order and chaos. 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: 3566 724234561 -425277769 122797126 -819353530 -164843877 -480446616 727335274 -693311883 65497522 -761721234 -41677807 -529875916 -27675070 233898867 535627877 643706980 -567243680 819802736 113800822 -236275572 849732143 837881716 -752121500 -114216670 366170984 880301452 966797547 -567794149 -729079280 779883844 702875520 218855789 650408940 -935810383 -290970755 224804494 187331949 824438601 148123073 779949167 -94912179 340256094 -542163242 716723175 749570173 -586320742 781562832 541350610 -597262396 627311226 -519875041 -713751911 -119280042 293435084 733925931 -394638812 528790583 -569705346 -587810792 -398225632 -266371630 -698692542 718840640 -512941460 356087440 -815662537 845953639 -113545817 301753909 203715212 711309820 -381668968 -521452785 588719638 101018031 962834883 -720…
Output: 727335274 122797126 727335274 -164843877 727335274 727335274 819802736 65497522 233898867 -41677807 -27675070 -27675070 233898867 535627877 643706980 819802736 819802736 849732143 849732143 849732143 880301452 880301452 -114216670 366170984 880301452 966797547 992605006 779883844 779883844 824438601 824438601 650408940 824438601 -290970755 224804494 824438601 824438601 845953639 779949167 781562832 340256094 716723175 716723175 749570173 781562832 781562832 845953639 627311226 627311226 733925931 -119280042 -119280042 293435084 733925931 845953639 528790583 718840640 -398225632 -398225632 -266371630 718840640 718840640 845953639 356087440 845953639 845953639 962834883 301753909 711309820 711309820 962834883 588719638 588719638 962834883 962834883 992605006 -700224290 213631763 468422471 -2…

Example 2:

Input: 3094 -294374990 -814727949 -886697020 266395864 -992491101 -600402962 -677210000 790496062 962658646 911718103 -983198990 397945055 149670995 -493212875 317580710 54215442 -753402189 916117633 -129618281 195807243 -104207854 247129629 785874725 285802562 -503182640 -858893213 497876455 -932426903 -302805404 475407392 829291743 -316663495 -849471719 -104155542 13886239 -642393720 -502428015 400230992 -575753106 781080440 840786293 425309300 -821264636 75962019 -282270285 -606193837 406989403 782172527 892634334 592690859 -35652512 239547548 348777821 417332615 -903803932 713359261 337159098 -634925846 804856611 -435201878 814409043 -36691523 518296554 -425286522 527186801 -113739893 -774210543 18000728 721803799 390668263 -658726107 282118248 121664207 -698112916 912387335 -510275969 -32221…
Output: 266395864 266395864 266395864 790496062 -600402962 790496062 790496062 962658646 999984031 916117633 397945055 916117633 317580710 317580710 916117633 916117633 916117633 941284628 195807243 247129629 247129629 785874725 829291743 497876455 497876455 497876455 829291743 -302805404 475407392 829291743 840786293 -104155542 -104155542 13886239 400230992 -502428015 400230992 781080440 781080440 840786293 892634334 782172527 75962019 406989403 406989403 406989403 782172527 892634334 912387335 713359261 239547548 348777821 417332615 713359261 713359261 804856611 804856611 804856611 814409043 814409043 912387335 518296554 527186801 527186801 721803799 18000728 18000728 721803799 912387335 912387335 282118248 912387335 912387335 912387335 941284628 -322217891 196318636 941284628 941284628 99998403…

Example 3:

Input: 2380 -271955680 -622439354 -6649455 -553406549 -609992533 299831908 -87141798 -761114383 -812416292 587408877 58725712 671268155 -846052092 88886316 642504674 -724250733 74349776 -346671989 -951555654 -580665466 415861096 -713943099 494968241 -641791550 13854816 -176594082 743687264 -512772390 -751816261 932396543 -647191513 480955616 479861406 -212056936 -983757339 692372279 691245661 459965802 442739287 472216318 166299433 -711133723 96917054 -608425586 -851110226 162915875 117264224 -664410826 -985785194 -223368000 6138227 764192256 132200079 201045941 -108343561 -24758960 741920720 -53081028 631899052 -105933883 824469893 696690206 31122582 -871726834 -704493683 -599140405 294711364 644766787 653525139 -63670853 -274355324 799585996 -105615832 -864844131 3256425 292759527 -141228571 20…
Output: -6649455 -6649455 299831908 299831908 299831908 587408877 587408877 587408877 587408877 671268155 671268155 743687264 88886316 642504674 743687264 74349776 415861096 415861096 -580665466 415861096 494968241 494968241 743687264 13854816 743687264 743687264 932396543 932396543 932396543 946070268 480955616 692372279 692372279 692372279 692372279 764192256 764192256 472216318 472216318 764192256 764192256 96917054 162915875 162915875 162915875 764192256 764192256 -223368000 -223368000 6138227 764192256 824469893 201045941 741920720 -24758960 741920720 824469893 631899052 824469893 824469893 946070268 799585996 294711364 -704493683 -599140405 294711364 644766787 653525139 799585996 799585996 799585996 946070268 3256425 3256425 292759527 418370597 209726164 229390133 229390133 62957420 22939013…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Piper's signals Reckoning - MEDIUM Coding Problem | CodeTikki