CT52809

The Taller Ahead of the Whispering signals

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Every season at the coral atoll of Pearldeep, someone must certify the cargo before shipping. This year the task falls to Cressida, armed only with the signals register. 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: 1725 -696389852 509974972 -210468569 -773608948 205532047 -725264124 -123224253 -338168194 -213786639 723442537 281354236 -947981810 497981311 -576341559 -787423827 -371662715 983167546 -989646938 -111468742 46857668 406283401 -173187991 155630986 -308135034 -569097234 -328936202 -119142786 -293015483 -600534443 497617769 511304456 456915399 -428110240 344328179 40103197 732682316 -600770712 726607860 765947187 -387844543 733296658 -677207546 -768682404 -919189532 244527436 371509284 108018302 -792926725 854474952 -688938267 18371444 -721322401 -502389354 97985404 -824644294 -833823538 618383596 597543263 316085738 387190715 211094595 -503321878 -392247750 430888103 377638412 473204070 -725090212 96317946 -136905566 951419322 479795398 -812066224 337502845 -15610408 -196581418 252990093 18…
Output: 509974972 723442537 205532047 205532047 723442537 -123224253 723442537 -213786639 723442537 983167546 497981311 497981311 983167546 -371662715 -371662715 983167546 984100075 -111468742 46857668 406283401 497617769 155630986 497617769 -119142786 -328936202 -119142786 497617769 497617769 497617769 511304456 732682316 732682316 344328179 732682316 732682316 765947187 726607860 765947187 854474952 733296658 854474952 244527436 244527436 244527436 371509284 854474952 854474952 854474952 951419322 18371444 97985404 -502389354 97985404 618383596 618383596 618383596 951419322 951419322 387190715 430888103 430888103 -392247750 430888103 473204070 473204070 951419322 96317946 951419322 951419322 966323596 966323596 337502845 966323596 252990093 252990093 966323596 966323596 184312815 966323596 98410…

Example 2:

Input: 2553 -777463577 -759863394 642238728 -730831276 -439301762 493040596 -768799493 328038670 52338736 -665667003 -942245569 -593601508 859501822 -458930244 -529529999 -303734420 984464236 226208559 421707006 -405078204 -529336534 776860717 603737809 -16478902 -581932820 -992634419 80151582 -576334699 -548588655 -912930833 157357076 -764506351 -205974137 -950741589 -945142159 450328222 -508826297 -641344429 970427826 909848122 -155150886 -553929023 349127283 -213123247 666114377 -390620087 -157355577 -857030734 -95812458 -452110837 -570064546 -808021420 498736588 -621685879 859992624 52911377 -157013456 -752387170 960704794 655712308 702188043 859585313 -431591580 37023044 -928735405 -521605219 -522923387 -379532246 -319717214 -99887299 -76014374 -735960319 -497392997 602701117 -428558682 1985…
Output: -759863394 642238728 859501822 -439301762 493040596 859501822 328038670 859501822 859501822 -593601508 -593601508 859501822 984464236 -303734420 -303734420 984464236 987119038 421707006 776860717 776860717 776860717 970427826 970427826 80151582 80151582 80151582 157357076 -548588655 157357076 157357076 450328222 -205974137 450328222 -945142159 450328222 970427826 970427826 970427826 987119038 960704794 349127283 349127283 666114377 666114377 859992624 -157355577 -95812458 -95812458 498736588 498736588 498736588 498736588 859992624 859992624 960704794 960704794 960704794 960704794 987119038 702188043 859585313 905277234 37023044 602701117 -521605219 -379532246 -379532246 -319717214 -99887299 -76014374 602701117 -497392997 602701117 659580118 198596531 343906981 343906981 569156491 659580118…

Example 3:

Input: 1440 -16941268 102940634 -974853129 671863897 917536198 54262137 426284102 124461012 -309833033 -470530554 -646648202 981159961 130148460 -764718129 726822812 -707796145 -290265116 385289930 -405970063 879786770 131139115 -343088549 116220824 859241102 845355142 446871120 509587874 -964060301 -885244739 -176177655 -744821817 -771904647 640457661 800318329 515429033 -640344819 -213611043 -136341652 -605285071 545470768 281682400 619355729 -969461677 73869144 -282311939 -658245758 573928808 856821354 844941954 200334571 538372218 858579676 -629041625 -777110826 337593133 191226738 490828222 -38687915 -786051118 -225849342 -891536580 870268617 -336529152 -343711032 233228458 223385574 705715299 231490370 745166957 772544295 844146876 -12549592 720587942 -26080 -485225104 365951503 -698747560 …
Output: 102940634 671863897 671863897 917536198 981159961 426284102 981159961 981159961 981159961 981159961 981159961 987669604 726822812 726822812 879786770 -290265116 385289930 879786770 879786770 947623936 859241102 116220824 859241102 870268617 856821354 509587874 640457661 -885244739 -176177655 640457661 640457661 640457661 800318329 856821354 545470768 -213611043 -136341652 545470768 545470768 619355729 619355729 856821354 73869144 573928808 573928808 573928808 856821354 858579676 858579676 538372218 858579676 870268617 337593133 337593133 490828222 490828222 870268617 870268617 -225849342 870268617 870268617 947623936 233228458 233228458 705715299 705715299 745166957 745166957 772544295 844146876 947623936 720587942 947623936 365951503 365951503 947623936 60096516 60096516 60096516 94762393…

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 Whispering signals - MEDIUM Coding Problem | CodeTikki