CT37911

Last signals of Zoya

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Zoya inherited the counting house at the copper works of Verdigris 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: 1492 -100982769 772249339 -799606596 191866483 -680155141 441034930 525816015 -729119424 306518976 -368312265 364436572 -541879007 820541266 -157601470 -79917657 -568023239 -299987896 38294239 296325661 -943390146 -753372485 215087738 708289767 177171310 -19640694 623105121 825285127 730336098 -48586561 936663957 -385955290 -979471697 53349674 943112753 11616740 -933636861 -751202533 -506880099 -163223612 547874284 -538633634 588756560 -238797262 285315233 394028335 969772565 -560145783 -463883264 445572251 96282303 545175091 -302229503 -731397892 -989106732 -824342043 510024747 253962378 -250038892 -354142923 -189958403 422557002 83444141 -981238615 219282636 311622718 -965547819 524796955 652582764 582932717 -856358510 -773749759 -576839768 606459313 483637433 -405240939 12425938 -325528…
Output: 772249339 820541266 191866483 441034930 441034930 525816015 820541266 306518976 364436572 364436572 820541266 820541266 825285127 -79917657 38294239 -299987896 38294239 296325661 708289767 -753372485 215087738 708289767 825285127 623105121 623105121 825285127 936663957 936663957 936663957 943112753 53349674 53349674 943112753 969772565 547874284 -751202533 -506880099 -163223612 547874284 588756560 588756560 969772565 285315233 394028335 969772565 972653611 -463883264 445572251 545175091 545175091 652582764 510024747 510024747 -824342043 510024747 524796955 422557002 -189958403 -189958403 422557002 524796955 219282636 219282636 311622718 524796955 524796955 652582764 972653611 606459313 -773749759 -576839768 606459313 972653611 972653611 12425938 972653611 972653611 991176973 653539777 6535…

Example 2:

Input: 2137 -921852083 850116350 775917248 -623337936 -419440819 -726846696 649365524 280183201 -581395342 825302478 -355250784 -211730197 391212199 525371160 444974861 -6375756 876181020 713668339 -489755389 -311878484 -719561132 -591871644 -219375601 452420975 -5139462 293044422 1568736 -140073088 300272226 261605282 151882983 439700326 781963903 690958980 -989240812 -20258862 768327472 958502703 945918654 632514410 391237481 970487565 -813108148 -384124118 -361797681 -427985644 -519689307 590583379 -178310742 194610920 -882594956 -751710233 -403976587 100280093 409447363 26888729 547049315 -268821344 -825495866 983470261 -69813997 457048243 -618184050 -587479059 816628904 633825930 -241166893 -468413872 -688473182 127537420 180883410 -511220385 -93059527 809119367 251205609 -562490552 40372969…
Output: 850116350 876181020 825302478 -419440819 649365524 649365524 825302478 825302478 825302478 876181020 -211730197 391212199 525371160 876181020 876181020 876181020 958502703 781963903 -311878484 -219375601 -591871644 -219375601 452420975 781963903 293044422 300272226 300272226 300272226 439700326 439700326 439700326 781963903 958502703 768327472 -20258862 768327472 958502703 970487565 970487565 970487565 970487565 983470261 -384124118 -361797681 590583379 590583379 590583379 983470261 194610920 409447363 -751710233 -403976587 100280093 409447363 547049315 547049315 983470261 983470261 983470261 993000146 457048243 816628904 -587479059 816628904 837891858 809119367 127537420 127537420 127537420 180883410 809119367 -93059527 809119367 837891858 403729690 403729690 837891858 300055114 837891858…

Example 3:

Input: 1388 -496597069 875566034 -778845133 -873896077 -606982241 -811084693 -701348535 956907845 733201754 948830964 78476520 566725347 800585417 -948139234 -823585676 -28205558 247502187 -432328269 -977729758 689067211 98362661 197511319 83969757 136242602 -51054802 742697002 629390688 -574326715 115274028 -944831434 -324550171 893079606 691311055 579039927 713423265 56938847 472881035 -266582703 -477912599 -189304452 68490053 -219780894 -24573597 -240672142 -841983727 464494904 80817043 780935181 669747551 561878883 -789234141 170748504 -612381204 -746186047 -306342059 929870116 748871119 -878593102 -649833558 737083674 245173535 843168618 686971546 -291846547 450630007 656454555 -783868847 717811853 -374220999 -227219049 -117981546 586268237 404191150 -604529500 -857284054 400457270 -36145167…
Output: 875566034 956907845 -606982241 -606982241 956907845 -701348535 956907845 999519657 948830964 999519657 566725347 800585417 893079606 -823585676 -28205558 247502187 689067211 689067211 689067211 742697002 197511319 742697002 136242602 742697002 742697002 893079606 893079606 115274028 893079606 -324550171 893079606 929870116 713423265 713423265 780935181 472881035 780935181 -189304452 -189304452 68490053 464494904 -24573597 464494904 464494904 464494904 780935181 780935181 929870116 929870116 929870116 170748504 929870116 -306342059 -306342059 929870116 999519657 843168618 -649833558 737083674 843168618 843168618 999519657 717811853 450630007 656454555 717811853 717811853 839219942 -227219049 -117981546 586268237 839219942 839219942 400457270 400457270 839219942 258015985 839219942 999519657…

Constraints:

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

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