CT42058

Last beacons of Sahil

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The harbor bell rings at the kelp forests of Tangledeep; Sahil weighs the day's beacons 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: 1241 -37538053 -10784082 820070353 -219166281 218409846 530817206 -706199780 -984591151 276210793 -375887460 779785316 -241753262 -314709305 475591962 322288428 667635886 472903935 -784422269 166577790 -327883376 -141312655 -844142823 -236230659 -858950659 490497519 -628057483 38912315 446225311 913518375 72289962 924617749 -406953987 60983518 -764238397 495489531 89670972 418222562 -531808724 709942151 -324734678 200923466 -406033427 947097432 401672719 954930567 -977008467 -69160625 737867236 729387041 512808136 -625907706 315131933 -746739843 164714140 177533168 -330388063 -414980520 -770209863 -152248261 117515050 60636774 -452641106 -498802162 -812019178 -365386300 -889549098 718226324 543688983 -337506643 -797478190 -86877918 -442300902 494485243 334120648 831141947 396648043 9211314…
Output: -10784082 820070353 913518375 218409846 530817206 779785316 276210793 276210793 779785316 779785316 913518375 475591962 475591962 667635886 667635886 913518375 490497519 166577790 490497519 -141312655 490497519 -236230659 490497519 490497519 913518375 38912315 446225311 913518375 924617749 924617749 947097432 60983518 495489531 495489531 709942151 418222562 709942151 709942151 947097432 200923466 947097432 947097432 954930567 954930567 970610942 -69160625 737867236 831141947 831141947 718226324 315131933 718226324 164714140 177533168 718226324 -152248261 -152248261 -152248261 117515050 718226324 718226324 -365386300 -365386300 -365386300 718226324 718226324 831141947 831141947 -86877918 -86877918 494485243 494485243 831141947 831141947 921131440 921131440 970610942 -294672846 33010926 3301…

Example 2:

Input: 2765 -967450982 770313244 -77907653 924992511 485675850 754824748 -417407397 -397899080 -419640199 -275331667 -120514804 435855731 41435757 63207897 369323367 -661467384 -319465371 -957850633 616879940 -873369026 -75925523 902276860 390524214 -786384332 -420537508 -974854314 263720847 808014275 753751163 -208702086 -923550558 500454944 855590192 -328909624 540622763 -882915020 -543232980 -420044255 197908018 -951211353 -694743229 73101610 14185899 -590013853 106592859 504509598 -104565421 667249682 -51501725 291226495 -540992469 880316392 -316048922 -354565517 -661215583 -363622679 -760285548 -462922587 -140358567 -330271178 -678576352 -67439915 -563047210 956242559 704053188 449779510 192973312 477535171 -971019237 984164124 -775591332 -157917636 -312330964 -928455012 -514416159 276965406…
Output: 770313244 924992511 924992511 956242559 754824748 902276860 -397899080 -275331667 -275331667 -120514804 435855731 616879940 63207897 369323367 616879940 -319465371 616879940 616879940 902276860 -75925523 902276860 956242559 808014275 -420537508 263720847 263720847 808014275 855590192 855590192 500454944 500454944 855590192 880316392 540622763 667249682 -543232980 -420044255 197908018 504509598 -694743229 73101610 106592859 106592859 106592859 504509598 667249682 667249682 880316392 291226495 880316392 880316392 956242559 -140358567 -140358567 -363622679 -140358567 -462922587 -140358567 -67439915 -67439915 -67439915 956242559 956242559 984164124 984164124 477535171 477535171 984164124 984164124 993458545 -157917636 276965406 276965406 -514416159 276965406 699737018 -620089677 -347818218 -34…

Example 3:

Input: 1599 -526147326 -363812699 -605730150 -655644338 -339925641 142505180 925426975 -501520483 -994069593 396654426 -736523748 26274196 -14635914 -536580765 178472415 274946161 802915123 581905736 995517242 -626113949 -870447886 249847283 205171198 124135820 553483369 -95142417 -376634606 109346815 726635219 -892318804 847084778 528670900 -70359332 -159780437 996947660 864881552 502872850 488659205 606314420 -266758442 -136418932 718361275 690944546 878980460 456828740 452829563 515572463 311983824 -357638672 -400115505 -498506504 943792711 -956073016 -138431808 -272796939 683718541 366537854 -432630010 -45678127 -243114057 -664459117 -618820830 -565535172 448012825 841828712 -552893584 -678230605 -243862052 309628904 -1416999 -878504911 -473389616 -999905151 -607707302 364871790 494400774 692…
Output: -363812699 -339925641 -339925641 -339925641 142505180 925426975 995517242 396654426 396654426 802915123 26274196 178472415 178472415 178472415 274946161 802915123 995517242 995517242 996947660 249847283 249847283 553483369 553483369 553483369 726635219 109346815 109346815 726635219 847084778 847084778 996947660 996947660 996947660 996947660 996968469 878980460 606314420 606314420 718361275 -136418932 718361275 878980460 878980460 943792711 515572463 515572463 943792711 943792711 943792711 943792711 943792711 979668586 -138431808 683718541 683718541 841828712 448012825 -45678127 448012825 448012825 -618820830 -565535172 448012825 841828712 890276937 -243862052 -243862052 309628904 364871790 364871790 -473389616 364871790 -607707302 364871790 494400774 692079060 890276937 890276937 94296844 …

Constraints:

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

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