CT47161

The signals at Screech Point

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Chetan found an old ledger of signals in the depot attic at the gull cliffs of Screech Point. The margin notes pose a precise question. 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: 1517 -420572078 477116219 19359102 -632482908 -728015204 777510361 -300829245 3093598 668754353 108064782 -33010406 598998349 417300645 -654733625 -765597233 -138952834 349061334 679592232 299568581 272200640 -540515155 -17470209 132408822 46518943 861913740 375207813 -83360561 -205438485 -554439069 808025078 730214064 936938352 -143238152 -563926800 -232067354 -912984790 -512152518 -274747554 -43300815 -998621837 521779980 907540838 356730260 -515863916 432169906 -386441759 -684121336 -420735855 942373348 -473235797 -576548457 -664786891 -58660217 -31704904 -893579123 -833145872 147688970 -785337572 482316173 -199741393 704836625 -226999249 130800945 -334801033 639485029 68558987 -533162926 -945323160 -11016656 -670806508 642398388 -79851834 -152506254 963728233 749660597 -901894051 54474…
Output: 477116219 777510361 777510361 777510361 777510361 861913740 3093598 668754353 679592232 598998349 598998349 679592232 679592232 -138952834 -138952834 349061334 679592232 861913740 861913740 861913740 -17470209 132408822 861913740 861913740 936938352 808025078 808025078 808025078 808025078 936938352 936938352 942373348 -43300815 -232067354 -43300815 -512152518 -274747554 -43300815 521779980 521779980 907540838 942373348 432169906 432169906 942373348 942373348 -420735855 942373348 963728233 -58660217 -58660217 -58660217 -31704904 147688970 -833145872 147688970 482316173 482316173 704836625 704836625 963728233 130800945 639485029 639485029 642398388 642398388 -11016656 -11016656 642398388 642398388 963728233 963728233 963728233 987727851 901620055 544744164 645066576 901620055 579943009 90162…

Example 2:

Input: 829 -66961462 -772142478 123746567 -742162033 589624016 -764388688 546877468 837407864 578850025 431297258 137554301 -81919676 -671705700 -127938475 -497757379 -122546670 534979739 -90998351 -158359429 929526138 786789921 157901752 -659530865 -587969599 -162365477 210237231 147595513 152147037 -23583226 -529508383 -603676524 -286825137 -125049303 -836631029 442702075 665841367 -148325010 -359643933 333117191 144060130 861009298 728758407 -213824611 748702909 604629576 345288130 865957588 781129699 311303601 727011114 99462370 -387296105 742104263 -831749768 970122213 -904330692 289034312 895685445 -877614796 -927675296 -542842419 -738661025 -357319298 -123205947 840130201 538693387 -729303803 -110587553 724570597 388017134 939875007 -616388096 598074292 -66332607 -216553448 629547495 40293…
Output: 123746567 123746567 589624016 589624016 837407864 546877468 837407864 929526138 929526138 534979739 534979739 534979739 -127938475 -122546670 -122546670 534979739 929526138 929526138 929526138 970122213 861009298 210237231 -587969599 -162365477 210237231 442702075 152147037 442702075 442702075 -286825137 -286825137 -125049303 442702075 442702075 665841367 861009298 333117191 333117191 861009298 861009298 865957588 748702909 748702909 865957588 865957588 865957588 970122213 970122213 727011114 742104263 742104263 742104263 970122213 970122213 994280791 289034312 895685445 939875007 -542842419 -542842419 -357319298 -357319298 -123205947 840130201 939875007 724570597 -110587553 724570597 939875007 939875007 994280791 598074292 629547495 629547495 629547495 922227613 922227613 -428384387 92222…

Example 3:

Input: 1198 88818780 -424401432 -442485201 495607842 -585901869 887803219 274371917 -63462336 751992024 969368001 651787547 -256579075 -524381312 -873302958 572354069 542819346 -404920054 642924873 -382023590 -262982890 74504818 296923649 596227075 612050519 963403237 -35001268 28733752 970677119 -210552209 234309361 360397835 -234278407 -238591814 84143626 -263643569 558655259 680206682 -610571252 -139507045 -849023157 -722152880 -547095901 256922288 700928718 868095714 157256528 -661959784 633761150 -969064716 710093764 810758976 -213797994 -769825759 -777072961 -512721340 196222418 531930012 156213466 196851477 462164551 340028579 757068394 -663954460 479492051 -598106616 -501457697 -929527982 7949441 -900905073 641319669 562646063 -193907670 678038123 -677593910 -701432142 -641647441 -6737089…
Output: 495607842 495607842 495607842 887803219 887803219 969368001 751992024 751992024 969368001 970677119 963403237 572354069 572354069 572354069 642924873 642924873 642924873 963403237 -262982890 74504818 296923649 596227075 612050519 963403237 970677119 28733752 970677119 983013243 234309361 360397835 558655259 84143626 84143626 558655259 558655259 680206682 700928718 -139507045 256922288 -722152880 -547095901 256922288 700928718 868095714 983013243 633761150 633761150 710093764 710093764 810758976 983013243 196222418 -512721340 -512721340 196222418 531930012 757068394 196851477 462164551 757068394 757068394 789649065 479492051 641319669 -501457697 7949441 7949441 641319669 641319669 678038123 678038123 678038123 789649065 -641647441 -641647441 303336068 303336068 789649065 -523636612 -8145785…

Constraints:

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

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