CT45098

Last signals of Ivo

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Ivo inherited the granary at the quays of Driftwood along with its curious bookkeeping system for signals. Time to make sense of it. 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: 198 929738208 387892847 864663475 -562732391 864067538 -166506851 -355889891 323018466 -415332535 75767570 -967571831 -160890464 -649773379 -288310556 278137022 89576714 -450264625 -358761185 144127287 -595196254 -8784271 231420962 -233001923 -294072619 -498279337 794680051 772013622 -643142979 424818328 -939657629 -122512145 -540735869 777407479 275669561 -406829319 693035841 797499362 435196553 -967594990 772541362 38685030 -795765099 227672278 -175740919 760092083 87435587 -523661587 16621008 -530016119 173192284 -483367798 -776524051 -832703441 -411754719 -599485175 -290198296 931965266 207143552 -592136469 286614400 119468029 -306564145 -660616308 -936291741 574002647 509801141 980267171 -37541250 163995384 390828335 552614230 -955264666 45138363 828103555 -509865554 -223042730 -66767…
Output: 931965266 864663475 931965266 864067538 931965266 323018466 323018466 794680051 75767570 278137022 -160890464 278137022 -288310556 278137022 794680051 144127287 -358761185 144127287 231420962 -8784271 231420962 794680051 794680051 794680051 794680051 797499362 777407479 424818328 777407479 -122512145 777407479 777407479 797499362 693035841 693035841 797499362 931965266 772541362 772541362 931965266 227672278 227672278 760092083 760092083 931965266 173192284 16621008 173192284 173192284 931965266 -411754719 -411754719 -411754719 -290198296 -290198296 931965266 980267171 286614400 286614400 574002647 574002647 574002647 574002647 574002647 980267171 980267171 992530763 163995384 390828335 552614230 828103555 45138363 828103555 910442850 -223042730 -108242223 -108242223 19508848 475067612 475…

Example 2:

Input: 2049 -836878128 -585560348 200311976 211506733 -94617556 760674656 652865511 -611535360 -657802503 449991253 25703708 -868272657 -865268218 -796466493 -565685234 961233374 -642645707 556247739 -515350373 269601490 -988348837 -591427919 -425229444 -252925441 40237864 191592927 49644693 833860392 186416809 -944454813 -233236534 445518027 595480231 377194211 -446636824 -252255459 903382608 616888583 -268679058 -762678187 68449020 480927224 613782004 -469728349 -565872935 17087051 130185266 -495580535 966103999 -198497832 556328475 959663420 -836911849 245612088 896357632 -73240071 476538447 958486390 782945232 -309812142 -107983389 184953691 -995451231 -327522580 -875133223 -253838379 945333154 237606494 -120146877 -590018529 -822462677 -575754519 589949541 842895684 498595667 -884454892 -806…
Output: -585560348 200311976 211506733 760674656 760674656 961233374 961233374 449991253 449991253 961233374 961233374 -865268218 -796466493 -565685234 961233374 966103999 556247739 833860392 269601490 833860392 -591427919 -425229444 -252925441 40237864 191592927 833860392 833860392 903382608 445518027 -233236534 445518027 595480231 903382608 903382608 -252255459 903382608 966103999 966103999 68449020 68449020 480927224 613782004 966103999 17087051 17087051 130185266 966103999 966103999 974424517 556328475 959663420 960248165 245612088 896357632 958486390 476538447 958486390 960248165 945333154 -107983389 184953691 945333154 -327522580 -253838379 -253838379 945333154 960248165 589949541 589949541 -575754519 -575754519 589949541 842895684 925594546 825765318 -806116715 93097740 825765318 -222471831…

Example 3:

Input: 3146 26231815 -496327430 -509760838 889686400 -416260049 -758666789 -801437472 -675002726 -256823748 484239669 502748936 186673007 659713598 498853000 460637901 827887953 321537132 -90073981 881237213 457607034 -859358887 -89286013 809216856 -181986373 -189032027 -458330571 269031382 982019458 917274591 402903903 552817853 432025145 -185661466 403242405 728050618 -639567838 216422093 128807957 -125069683 73513924 46455526 -261890433 -99979775 784040613 -53076258 -927782990 -440108411 225390155 826609035 -437462322 -910641137 664801340 701578138 -196129263 -568433113 -749713145 -361504427 356920062 220475733 -38938314 -448207626 -685943009 -427147851 440963377 724580232 288828372 867303215 284181203 846684309 -640377416 -684636295 -495000855 -502893462 -103933479 803429421 613666537 2038873…
Output: 889686400 889686400 889686400 982019458 -256823748 -675002726 -675002726 -256823748 484239669 502748936 659713598 659713598 827887953 827887953 827887953 881237213 881237213 881237213 982019458 809216856 -89286013 809216856 982019458 269031382 269031382 269031382 982019458 995251675 941818657 552817853 728050618 728050618 403242405 728050618 784040613 216422093 784040613 784040613 73513924 784040613 784040613 -99979775 784040613 826609035 225390155 -440108411 225390155 826609035 867303215 664801340 664801340 701578138 724580232 356920062 -361504427 -361504427 356920062 440963377 440963377 440963377 -427147851 -427147851 440963377 724580232 867303215 867303215 941818657 846684309 941818657 -495000855 -495000855 -103933479 -103933479 803429421 941818657 941818657 941818657 960415527 34349576…

Constraints:

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

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