CT46690

Wade and the Amber signals

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The harbor bell rings at the dune sea of Caravanrest; Wade weighs the day's signals manifests and starts the calculations. 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: 2505 450362884 -826447139 -783136364 280535402 359581692 -59054371 -79010752 438392753 -972643215 -461496328 467437704 46106853 -360902649 -359571561 -191237738 135500153 -323226114 732485598 405049473 -56273174 337018434 -292534087 -354691712 -378956689 -643688398 -663541156 -81448723 28817808 -68731148 -8379966 795227771 -921750266 599172522 344696707 338440968 366967142 -605466796 -928019425 31596023 -392054921 -677962137 86545584 -416816897 508721082 665153126 -786713301 -562029013 -545651797 -573777967 -105229699 763503647 268751053 -98052889 599106503 -930932795 -318947651 -608135494 -256461932 -565594110 -529617585 193327886 -218036733 72213438 986201801 862613258 378116988 927119797 813696623 -661219066 476030 132455378 -32962412 812635375 -160483621 -206023753 767053799 -995789930…
Output: 467437704 -783136364 280535402 359581692 438392753 438392753 438392753 467437704 -461496328 467437704 732485598 135500153 -359571561 -191237738 135500153 732485598 732485598 795227771 795227771 337018434 795227771 -81448723 -81448723 -81448723 -81448723 -81448723 28817808 795227771 -8379966 795227771 986201801 599172522 665153126 366967142 366967142 508721082 31596023 31596023 86545584 86545584 86545584 508721082 508721082 665153126 763503647 -562029013 -545651797 -105229699 -105229699 763503647 986201801 599106503 599106503 986201801 -318947651 -256461932 -256461932 193327886 -529617585 193327886 986201801 72213438 986201801 993192347 927119797 927119797 981494762 981494762 476030 132455378 812635375 812635375 981494762 767053799 767053799 981494762 -206622157 167752956 628631062 62863106…

Example 2:

Input: 3453 -48635251 -185821848 845544912 512859899 -233946373 -244606606 669014236 63337071 992701367 -743743133 626216000 201382695 418617321 185333623 920724911 836456434 -379773024 133217308 -105488604 824805862 906767564 526792223 807223931 844364609 442784923 503953663 -199966615 990128323 242004985 672053959 -247628960 -505118838 -166566914 -657732794 337819696 -25581283 -645091495 -414569763 446255841 -760201195 -364779101 -177628903 -475275807 -272338263 94667567 591668519 544170977 -260705905 627277001 881240806 567484776 851933361 237661584 791219464 -939441187 591930129 -636266450 647530154 752641444 -728893206 507850916 -546414756 -278063411 837369137 25665977 411901016 -723460448 -431982550 -744278773 -490638075 -845544362 -368014730 -559279982 358883935 706159462 826024599 4644089…
Output: 845544912 845544912 992701367 669014236 669014236 669014236 992701367 992701367 996745817 626216000 920724911 418617321 920724911 920724911 990128323 906767564 133217308 824805862 824805862 906767564 990128323 807223931 844364609 990128323 503953663 990128323 990128323 992130337 672053959 881240806 -166566914 -166566914 337819696 337819696 446255841 446255841 -414569763 446255841 591668519 -364779101 -177628903 94667567 -272338263 94667567 591668519 627277001 627277001 627277001 881240806 932072133 851933361 932072133 791219464 837369137 591930129 647530154 647530154 752641444 837369137 507850916 837369137 -278063411 837369137 850152813 411901016 706159462 -431982550 -368014730 -490638075 -368014730 -368014730 358883935 358883935 706159462 826024599 850152813 850152813 850152813 932072133 …

Example 3:

Input: 3989 759260236 490734002 986975037 -568125719 86134423 123972917 50813369 683282718 -578021799 -991828582 -31930112 414303533 -297230054 -721689507 -490881117 -544578016 106375017 195275361 -909401563 826335546 -615759483 -321730753 -166147993 177885684 202343695 126553433 -672030769 810895507 572233277 -562251654 918379760 208877905 -358589125 -942804324 503179426 -961836331 980298323 655789973 305788310 -574066141 394731673 636161518 -938234023 -957667729 -936809803 515299801 -903664035 -412357185 351634322 -987003332 945715675 179281633 -410518110 -207057179 -979821797 -62736074 -337084178 698930870 672571852 -99679979 -557154838 -275953805 -702218576 -869597725 -865524586 -882105560 886669803 694293452 250418323 -922904211 427682876 644012727 742524300 -1694572 -690327591 -32940825 -46…
Output: 986975037 986975037 988584885 86134423 123972917 683282718 683282718 826335546 -31930112 -31930112 414303533 826335546 106375017 -490881117 106375017 106375017 195275361 826335546 826335546 918379760 -321730753 -166147993 177885684 202343695 810895507 810895507 810895507 918379760 918379760 918379760 980298323 503179426 503179426 503179426 980298323 980298323 981097232 945715675 394731673 394731673 636161518 945715675 -936809803 -936809803 515299801 945715675 -412357185 351634322 945715675 945715675 955655558 698930870 -207057179 -62736074 -62736074 698930870 698930870 886669803 886669803 886669803 -275953805 886669803 886669803 -865524586 886669803 886669803 955655558 742524300 427682876 427682876 644012727 742524300 760127236 760127236 -32940825 760127236 760127236 807328586 129669696 12…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Wade and the Amber signals - MEDIUM Coding Problem | CodeTikki