CT43758

Felix and the Topaz signals

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The registry keeper Felix has been asked to prepare the winter inventory. On the desk lies a long table of signals readings. 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: 3392 962681871 -682268642 719004149 83863087 375700659 -332911286 -462496298 262571675 -568460926 -944065533 735734549 -260691786 940880571 746702917 -713912154 -487032486 167486697 881353616 277141689 -218615782 -400600459 548881496 243553518 436574465 885000754 -119265777 -105460023 -584350989 -732937144 227094649 183629117 -417317943 54569975 -25829170 309061754 776697284 872809948 690719509 99487973 -716400720 698061029 -759706101 -935650923 129383456 102918968 -835653480 -115004511 581956 -522749966 211696463 -391369398 646080663 -346306704 -541478598 -471965541 313773248 890642950 -584182600 611128963 43787531 68471911 154286084 937322812 941945195 -324904876 454808861 144743767 -392277791 832769571 146490390 507790268 -228939094 -903943894 -470823323 271957748 -799674331 241818808 2…
Output: 976819221 719004149 735734549 375700659 735734549 262571675 262571675 735734549 735734549 735734549 940880571 940880571 941945195 881353616 -487032486 167486697 881353616 885000754 548881496 548881496 548881496 885000754 436574465 885000754 890642950 -105460023 227094649 227094649 227094649 309061754 309061754 54569975 309061754 309061754 776697284 872809948 890642950 698061029 698061029 698061029 890642950 129383456 129383456 211696463 211696463 -115004511 581956 211696463 211696463 646080663 646080663 890642950 313773248 -471965541 313773248 890642950 937322812 611128963 937322812 68471911 154286084 937322812 941945195 976819221 454808861 832769571 832769571 832769571 902988511 507790268 707448112 271957748 -470823323 271957748 707448112 241818808 707448112 707448112 779904819 779904819 …

Example 2:

Input: 3889 -771903772 -637209935 -201725572 -397904253 613172860 296325321 -174361781 475927297 -692550018 -644725011 -812004157 -288471401 751991849 -993562526 -438825687 -78827743 270648039 -972380319 -831720534 833815869 -768133081 530490008 667081982 -935240589 -236913079 -763543710 241756167 -983919547 558044099 -58825186 -832611381 -833017523 -480198008 -556425314 -449987164 -169594236 393649156 -909773354 -839169850 -311896043 966263205 32011013 -628990457 325153001 45098295 -515112591 907772633 -900476446 -424532539 -480582098 856369658 -224702172 -784884503 -727302691 872174294 -846696147 380579689 804777335 -59238452 46877591 -470433823 907353865 -912406921 -472871283 -830893600 641210596 -787640255 416603076 -694276301 218793448 -214192229 -188974825 634979429 -843067236 883802823 481…
Output: -637209935 -201725572 613172860 613172860 751991849 475927297 475927297 751991849 -644725011 -288471401 -288471401 751991849 833815869 -438825687 -78827743 270648039 833815869 -831720534 833815869 966263205 530490008 667081982 966263205 -236913079 241756167 241756167 558044099 558044099 966263205 393649156 -480198008 -480198008 -449987164 -449987164 -169594236 393649156 966263205 -839169850 -311896043 966263205 994877289 325153001 325153001 907772633 907772633 907772633 994877289 -424532539 856369658 856369658 872174294 872174294 -727302691 872174294 907353865 380579689 804777335 907353865 46877591 907353865 907353865 994877289 -472871283 641210596 641210596 883802823 416603076 634979429 218793448 634979429 -188974825 634979429 883802823 883802823 994877289 638219870 737032101 613969055 62…

Example 3:

Input: 3090 124866457 96395098 763616717 696435760 399380014 -526204455 65791945 813034238 -885199554 -455246295 -391318917 -555859546 449573496 -742942221 -213139836 345539410 -459766736 508502683 -382847657 -697888896 28278647 532972995 -328296744 163436516 -433311160 771217277 -136048444 244628025 -901289587 858413223 371634477 362611704 27069956 -545212834 -291867109 -65735599 783980479 184682491 505829416 347904496 -964838806 188795006 -726456800 -536514248 -409801853 -251897276 520092313 123055858 642968152 -122293707 995127349 -261680103 227577779 287508829 185229505 487435113 -541954138 512791199 42511897 881205455 536316244 644808893 707084749 -566416996 -331405573 -557664265 740038317 341695069 955950608 -798455784 -584975180 -326041800 435998647 -508884954 532952441 -973514616 21427372…
Output: 763616717 763616717 813034238 813034238 813034238 65791945 813034238 858413223 -455246295 -391318917 449573496 449573496 508502683 -213139836 345539410 508502683 508502683 532972995 28278647 28278647 532972995 771217277 163436516 771217277 771217277 858413223 244628025 858413223 858413223 995127349 783980479 783980479 783980479 -291867109 -65735599 783980479 995127349 505829416 520092313 520092313 188795006 520092313 -536514248 -409801853 -251897276 520092313 642968152 642968152 995127349 995127349 998983303 227577779 287508829 487435113 487435113 512791199 512791199 881205455 881205455 955950608 644808893 707084749 740038317 -331405573 740038317 740038317 955950608 955950608 958866493 -584975180 -326041800 435998647 532952441 532952441 801169049 214273724 801169049 845446171 -506573840 28…

Constraints:

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

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