CT50313

The Taller Ahead of the Tempest registers

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Piper runs the loft at the salt flats of Palemere. Today the books show a list of registers, and the numbers must be worked out before sundown. 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: 1369 307198599 27239759 -872124834 -692576055 614939076 -337345425 547739484 -107114803 -661033433 -459967702 -692986196 917653848 -352679366 -664186231 -668476995 733126699 -5111214 673363957 971509759 96397174 -90231052 -281684911 910800881 -607053055 -124673735 289310624 -150838631 835258858 810312234 -702742653 529860019 129154249 -365238782 613744772 -48118056 -520079633 410490432 579790817 -968837557 775259350 371108872 66776860 -169321390 773578866 -720911640 -214531096 42783878 -513149982 -748108140 -54599023 969789033 508953936 -448794315 -351375115 931902524 734492224 -471726615 385147669 127951198 -629949006 297173935 863247708 751243184 -366691376 290821445 555706217 754204044 498196669 -309165811 -25312083 -544689678 -231965569 -411922720 -947606373 994677203 -291166746 495933…
Output: 614939076 614939076 -692576055 614939076 917653848 547739484 917653848 917653848 -459967702 917653848 917653848 971509759 733126699 733126699 733126699 971509759 673363957 971509759 994677203 910800881 910800881 910800881 969789033 -124673735 289310624 835258858 835258858 969789033 969789033 529860019 613744772 613744772 613744772 775259350 410490432 410490432 579790817 775259350 775259350 969789033 773578866 773578866 773578866 969789033 -214531096 42783878 969789033 -54599023 -54599023 969789033 994677203 931902524 -351375115 931902524 994677203 863247708 385147669 863247708 297173935 297173935 863247708 994677203 754204044 290821445 555706217 754204044 994677203 994677203 -25312083 994677203 -231965569 994677203 994677203 994677203 996036594 495933374 566309439 975664343 993110622 39237…

Example 2:

Input: 449 539857399 -111019219 441794271 703026765 609732175 -252899602 2438397 275742827 -973769878 -597855744 -206826232 105369038 -636116400 117751420 -439595136 -794886201 -821937502 963894000 -543800084 -228324914 -527127115 -467020701 335141745 735093603 172263976 -64518318 43035373 630264442 -313641196 -992373380 -150687952 -682390864 -671037908 -224408434 247448523 -919916220 752888838 -155424993 -184101161 414219150 -656715300 362082129 306198029 -524284084 -243094041 495544037 827470590 -163328396 -782074911 93941178 -675841720 210428491 599995981 724706579 578447251 41325156 970489826 866463133 -28848933 614737218 688674611 974626630 842244436 -26394843 67895036 -479644615 633827162 81103022 -884760587 201390648 -427723863 790155854 7340368 112132123 -497488081 1645060 508723716 48844…
Output: 703026765 441794271 703026765 963894000 963894000 2438397 275742827 963894000 -597855744 -206826232 105369038 117751420 117751420 963894000 963894000 963894000 963894000 970489826 -228324914 335141745 -467020701 335141745 735093603 752888838 630264442 43035373 630264442 752888838 -150687952 -150687952 247448523 -671037908 -224408434 247448523 752888838 752888838 827470590 414219150 414219150 495544037 362082129 495544037 495544037 -243094041 495544037 827470590 970489826 93941178 93941178 210428491 210428491 599995981 724706579 970489826 970489826 970489826 974626630 974626630 614737218 688674611 974626630 988339013 869521117 67895036 633827162 633827162 790155854 201390648 201390648 790155854 790155854 869521117 112132123 508723716 1645060 508723716 676776138 676776138 747621979 747621979…

Example 3:

Input: 2244 51814814 -306596466 -260867008 -46258992 -831842011 81479801 837860956 246478157 -93977990 505184470 -738790964 150588552 319256015 -381753003 335158310 604545032 -725075950 -865381752 934349183 734345940 -262456883 395139886 676614490 768300308 -961362575 -355515972 176811394 926562552 467181625 790000909 721541502 441304481 286593643 -939277515 -453632236 -417492385 -462203322 -733788369 -32601573 -523799940 -439002665 -44025112 -687207180 -964417630 -105067053 785048401 865275798 -130475910 -453841007 680787893 603179186 -848720343 542578031 772647105 701993220 -492292571 499126520 -417295534 -673645977 238989278 24958281 -419418227 -469318774 -750609480 73048049 416550840 -594688956 -254119162 19435463 -361789647 581859615 886045557 -408652709 -902316197 -627199506 226847959 -1893…
Output: 81479801 -260867008 -46258992 81479801 81479801 837860956 934349183 505184470 505184470 604545032 150588552 319256015 335158310 335158310 604545032 934349183 934349183 934349183 986271363 768300308 395139886 676614490 768300308 926562552 -355515972 176811394 926562552 986271363 790000909 865275798 785048401 785048401 785048401 -453632236 -417492385 -32601573 -32601573 -32601573 785048401 -439002665 -44025112 785048401 -105067053 -105067053 785048401 865275798 886045557 680787893 680787893 772647105 772647105 542578031 772647105 886045557 886045557 499126520 581859615 238989278 238989278 416550840 73048049 73048049 73048049 73048049 416550840 581859615 -254119162 19435463 581859615 581859615 886045557 986271363 226847959 -627199506 226847959 392562056 201648737 392562056 404511542 809635873…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Taller Ahead of the Tempest registers - MEDIUM Coding Problem | CodeTikki