CT47807

The registers at Winterholt

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Morning light hits the snowberry thicket of Winterholt as Morgana unrolls the day's manifest of registers. The tally will decide the next shipment. 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: 2404 773362492 593234002 -861796645 345505898 -213116617 -529672383 -436563736 604703048 360858827 990141854 392823890 956975431 202547794 -302836797 -553925171 433443008 216563772 -557848781 989267672 455038843 -677350311 -248057569 -672613046 -577033274 -446849616 564605844 643133137 -259386821 987407867 706224096 477750720 -407723932 -55246322 654989695 -391181884 -945660932 -645456891 169286088 130920750 -787776526 747940747 595629907 -752130261 776098226 -883340132 908247030 -45330555 -408867242 -912790850 413288407 605946823 125874691 -583792265 -701493939 892600679 -887728283 -614368060 798822865 545720056 202227345 740249883 -236830315 -379183049 -400001472 636104126 -16096488 -394921699 854975525 622119713 825327366 363377447 563481439 305348582 700176211 -600371520 665623488 3906…
Output: 990141854 604703048 345505898 604703048 604703048 -436563736 604703048 990141854 990141854 992186756 956975431 989267672 433443008 433443008 433443008 989267672 989267672 989267672 992186756 564605844 -248057569 564605844 -577033274 -446849616 564605844 643133137 987407867 987407867 988115693 747940747 654989695 -55246322 654989695 747940747 169286088 -645456891 169286088 747940747 747940747 747940747 776098226 776098226 776098226 908247030 908247030 929295502 413288407 413288407 413288407 605946823 892600679 892600679 892600679 892600679 905513251 -614368060 798822865 854975525 740249883 740249883 854975525 636104126 636104126 636104126 854975525 854975525 854975525 905513251 825327366 850009266 563481439 700176211 700176211 850009266 665623488 850009266 850009266 850009266 905513251 5487…

Example 2:

Input: 1541 882135375 -553115362 -444418267 777520492 142560274 -957517298 577991399 733784205 502720414 320008849 498651815 -78576698 241948013 -340197028 158030190 792441543 977181369 732791810 -627977666 772287809 -980238046 431930778 -861579912 877558811 -18514792 656512135 -197649619 -770741474 27038975 -487117414 -586329083 -993378062 742849309 355193919 -765961697 -748589067 -694323765 364173766 937946081 975852964 -869488266 103998145 -849539874 -248675497 82026238 -345833262 164289924 498534802 -565815010 562904542 825748724 -774353712 581387080 499428418 993367038 -135089578 -162616042 -845086531 -205643004 -614749756 -521150518 -220053210 831604152 -350679072 579916947 -300392448 539427520 -745933598 -586107945 717919851 296747405 183977208 977933094 624464068 -42475854 -707559483 -767…
Output: 977181369 -444418267 777520492 792441543 577991399 577991399 733784205 792441543 792441543 498651815 792441543 241948013 792441543 158030190 792441543 977181369 993367038 772287809 772287809 877558811 431930778 877558811 877558811 937946081 656512135 742849309 27038975 27038975 742849309 742849309 742849309 742849309 937946081 364173766 -748589067 -694323765 364173766 937946081 975852964 993367038 103998145 164289924 -248675497 82026238 164289924 164289924 498534802 562904542 562904542 825748724 993367038 581387080 993367038 993367038 996024099 831604152 831604152 -205643004 831604152 -521150518 -220053210 831604152 977933094 579916947 717919851 539427520 717919851 -586107945 717919851 977933094 977933094 977933094 985121299 844243716 373423949 -76760485 373423949 -470269560 373423949 3734…

Example 3:

Input: 2674 -951038725 -858389617 -374090976 649935601 402007613 737511898 983259964 446311772 799523195 -847457499 267096870 687661423 -247885529 -87893491 -292967911 -649340282 626084461 282336731 567309644 358309184 507636707 287571038 -352412919 507979902 -103797719 -270000306 640735601 -303314540 667160272 -55814178 473782258 757859414 -828643932 -673319340 -680904411 -942531274 -721168373 391939725 -356380661 203427699 89960340 208265513 -825144249 74347480 442928521 758507171 -62383987 -675982407 126834335 756695176 779655333 569966076 986475385 -741980633 499016979 -604241228 -963172095 328046230 -160609153 -854538597 871466299 838638095 -33674971 941170240 251083157 -93921581 62320515 -698081141 213290325 754229593 712114123 666357767 -611621912 863608640 -935716059 -444917938 68178039 -…
Output: -858389617 -374090976 649935601 737511898 737511898 983259964 986475385 799523195 986475385 267096870 687661423 757859414 -87893491 626084461 626084461 626084461 640735601 567309644 640735601 507636707 507979902 507979902 507979902 640735601 640735601 640735601 667160272 667160272 757859414 473782258 757859414 758507171 -673319340 391939725 391939725 -721168373 391939725 442928521 203427699 208265513 208265513 442928521 74347480 442928521 758507171 779655333 126834335 126834335 756695176 779655333 986475385 986475385 995303609 499016979 871466299 328046230 328046230 871466299 871466299 871466299 941170240 941170240 941170240 948455137 754229593 62320515 213290325 213290325 754229593 863608640 863608640 863608640 863608640 948455137 -444917938 68178039 155032397 155032397 155032397 53743861…

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The registers at Winterholt - MEDIUM Coding Problem | CodeTikki