CT45190

Lothar's Woven signals

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Before the gates of the northern keep of Frostgate close for winter, Lothar must finish the signals ledger - one figure at a time. 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: 1627 632535051 -175928576 -744784159 -610146292 -189110040 -823578131 416095781 -705730408 703674115 97538727 584826429 768250977 -309119054 -697088019 -123566755 65188674 49088427 232732337 170848821 -319753274 -960509485 -288384336 335664658 -691357201 -331258044 114228686 444278878 -493293789 -757744699 -591168209 269312959 -67726422 -819257294 969136161 858612657 -165507270 -978562193 226549383 -169905797 -268643841 -226423563 -68299171 -976263120 -200487160 575902370 813601323 506473844 -373902812 -259046746 -751191740 -934941704 -907473184 -353538135 -857447954 -579779291 -216833997 -78226852 -763761049 814894577 581103512 -362364165 -186796937 -856466198 202009004 -627708060 432497167 -66785900 -997024851 -40930273 -553015320 -118536082 80478087 346865502 -528713239 33354538 -422399…
Output: 703674115 416095781 -610146292 -189110040 416095781 416095781 703674115 703674115 768250977 584826429 768250977 969136161 -123566755 -123566755 65188674 232732337 232732337 335664658 335664658 -288384336 -288384336 335664658 444278878 -331258044 114228686 444278878 969136161 269312959 -591168209 269312959 969136161 969136161 969136161 981624153 898624379 226549383 226549383 575902370 -68299171 -226423563 -68299171 575902370 -200487160 575902370 813601323 814894577 814894577 -259046746 -216833997 -353538135 -907473184 -353538135 -216833997 -579779291 -216833997 -78226852 814894577 814894577 898624379 898624379 -186796937 202009004 202009004 432497167 432497167 470224061 -40930273 -40930273 80478087 -118536082 80478087 346865502 470224061 33354538 470224061 470224061 470224061 470224061 8986…

Example 2:

Input: 438 -274280616 -653435595 494948176 -953565801 838627247 502968710 -153237594 -345846492 -392715707 -571367767 934585512 -393442170 550204582 929103351 -486839010 623954871 121453290 136281650 482326283 -786084760 926357638 829586167 250315051 -46481128 -411816191 -875133935 -31600883 -583526605 -849960784 693360331 -489394159 610217695 -947451879 -140402851 -211633897 436450465 -433800408 477448124 -384754909 697038178 -503346298 -733091978 -356077112 -615970746 -311995410 -284307948 -831409685 116420841 658605120 875944585 329448185 285287974 -783143536 -751975319 -312408219 -98796129 34875100 244832451 -470761073 -340151529 -765017944 -995184567 -395830262 221413706 626050569 31857250 -923034204 401668430 687508658 -481286325 -188540945 -898194384 -572242096 -878696871 -567004196 -16808…
Output: 494948176 494948176 838627247 838627247 934585512 934585512 934585512 934585512 934585512 934585512 982270090 550204582 929103351 982270090 623954871 926357638 136281650 482326283 926357638 926357638 982270090 875944585 693360331 -31600883 -31600883 -31600883 693360331 693360331 693360331 697038178 610217695 697038178 -140402851 436450465 436450465 477448124 477448124 697038178 697038178 875944585 -356077112 -356077112 -311995410 -311995410 -284307948 116420841 116420841 658605120 875944585 982270090 626050569 626050569 -751975319 -312408219 -98796129 34875100 244832451 626050569 -340151529 221413706 -395830262 -395830262 221413706 626050569 687508658 401668430 401668430 687508658 982270090 -188540945 -168085708 -572242096 -567004196 -567004196 -168085708 982270090 -185399107 982270090 989…

Example 3:

Input: 3262 -590183909 -562374167 -847521457 -530328902 586046179 -407413332 -107649992 -435803538 403761304 740446572 479995426 769324025 412584094 -733514150 -253842799 -70543100 243653345 433832874 191967655 -979469363 253148197 -905461773 -621690569 -634954681 -691389911 -950576561 882965808 -219212219 812526985 802827579 -333707709 116433996 -570146636 7158772 -124053864 6477086 -280063483 528354683 -12442587 857090728 -949818941 129066330 772559284 -102797084 500367123 671007646 -319693353 -749916018 115249606 194026134 -795261783 180159929 -683788094 949365985 690310478 449288008 343326438 -983571484 378560742 533289763 68929796 -87146041 -100604495 54652327 -789225200 381599625 -558111005 550638621 -665791728 -800253223 -234236902 338482386 10703893 505234629 720539325 -235319833 -9664104…
Output: -562374167 -530328902 -530328902 586046179 740446572 -107649992 403761304 403761304 740446572 769324025 769324025 882965808 433832874 -253842799 -70543100 243653345 433832874 882965808 253148197 253148197 882965808 -621690569 882965808 882965808 882965808 882965808 949365985 812526985 857090728 857090728 116433996 528354683 7158772 528354683 6477086 528354683 528354683 857090728 857090728 949365985 129066330 772559284 949365985 500367123 671007646 949365985 115249606 115249606 194026134 949365985 180159929 949365985 949365985 954403139 720539325 533289763 378560742 378560742 533289763 550638621 381599625 54652327 54652327 381599625 381599625 550638621 550638621 720539325 -234236902 -234236902 338482386 505234629 505234629 720539325 851664042 121588882 121588882 140076573 140076573 26831525…

Constraints:

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

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