CT23231

Emir's registers Distance Order

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

At the tannery row of Leatherwick, Emir records each registers in a worn leather ledger. The guild wants answers, not guesses. Task: Sort the array by absolute value ascending; for equal |x|, the smaller value comes first. Print the sorted array. Input format: First line: n. Second line: n integers. Output format: Print the sorted values space-separated. Constraints: 1 <= n <= 899; -1000000000 <= a[i],x <= 1000.

Example 1:

Input: 263 -779173890 -463424081 -678703637 -909096895 -2113452 -723239041 -637500688 -982528719 -987452710 -326548332 -345341813 -297432081 -349892819 -251517135 -15068487 -7680933 -453214359 -921116731 -903221915 -73199586 -220051757 -811788614 -598904982 -380127934 -754121764 -590391100 -611706934 -173507288 -640923380 -124962892 -393598071 -955152027 -773748879 -284424559 -446987367 -907199087 -690963413 -258239247 -667045294 -240277243 -124822701 -317324248 -384837770 -740864906 -382386667 -460747452 -822848252 -269725913 -318112162 -480395156 -616029923 -596251632 -147611927 -352605104 -480543483 -106013194 -419592362 -471692395 -83852728 -843424048 -282973803 -37599021 -16728819 -513014417 -605741070 -577247196 -712342461 -785548660 -429743565 -22988004 -717943177 -864284240 -441853376 -42…
Output: -2095300 -2113452 -7680933 -13632154 -15068487 -16728819 -22041702 -22988004 -25825236 -26187549 -34339250 -37599021 -38602890 -39350054 -40042670 -43260646 -50248202 -53628540 -56117829 -57741797 -58846610 -66133587 -73058252 -73199586 -83852728 -102948231 -106013194 -110105199 -111523002 -114555003 -124822701 -124962892 -124968819 -128481964 -129530521 -132249480 -135577294 -137194795 -138076507 -142398183 -143359691 -145318556 -147611927 -167338413 -168715530 -170356592 -171578614 -173507288 -176250428 -177268829 -179043535 -179324656 -189756976 -190456204 -191736026 -192439626 -192594896 -195049485 -197101914 -211106218 -211223328 -214761186 -214934572 -216308729 -218650954 -219005792 -220051757 -221565779 -223645727 -231215804 -231492206 -239402079 -240277243 -250175293 -251455161 -25…

Example 2:

Input: 54 -772059505 -662407899 -846192367 -664394614 -1574039 -318448250 -280055241 -886400621 -375617425 -949380629 -393945421 -29939366 -934291049 -166388766 -781162044 -962605880 -293100838 -817314313 -294265078 -975079216 -207791780 -452497800 -447914388 -278753998 -782044241 -306685193 -294105332 -436855004 -518596428 -159416248 -479377849 -648579143 -254037142 -489994875 -314853399 -460713134 -189119893 -959635836 -70960146 -50607737 -585213742 -483093171 -230418621 -913022530 -176831180 -695109740 -187208627 -279809906 -414681412 -962564367 -343614309 -234319571 -235035448 -411068892
Output: -1574039 -29939366 -50607737 -70960146 -159416248 -166388766 -176831180 -187208627 -189119893 -207791780 -230418621 -234319571 -235035448 -254037142 -278753998 -279809906 -280055241 -293100838 -294105332 -294265078 -306685193 -314853399 -318448250 -343614309 -375617425 -393945421 -411068892 -414681412 -436855004 -447914388 -452497800 -460713134 -479377849 -483093171 -489994875 -518596428 -585213742 -648579143 -662407899 -664394614 -695109740 -772059505 -781162044 -782044241 -817314313 -846192367 -886400621 -913022530 -934291049 -949380629 -959635836 -962564367 -962605880 -975079216

Example 3:

Input: 129 -197313564 -187443600 -631140039 -175486693 -741552964 -573635709 -46124853 -234100204 -494345727 -814078271 -452457877 -578128945 -52466363 -948678762 -674674198 -989990455 -356900287 -890084915 -661924105 -222337111 -553919319 -74503079 -870527009 -168097205 -143139 -414706579 -619115462 -207575941 -371461690 -263287649 -85608951 -178988619 -78555471 -995626702 -139378122 -287759573 -325456997 -90622875 -696922587 -168899842 -924581268 -721540300 -737782703 -484077036 -20019624 -305516942 -258985688 -241210585 -579569473 -810473797 -616608974 -17936488 -416485383 -649258253 -905457759 -537423414 -539286526 -938908268 -561917296 -153943626 -212320425 -949104817 -180867479 -132951738 -78980068 -366161224 -395665892 -348782086 -681917527 -777871112 -44332441 -182000724 -326030258 -31270…
Output: -143139 -17936488 -20019624 -29498026 -44332441 -46124853 -52466363 -67790957 -74503079 -76709069 -78555471 -78980068 -79703372 -85608951 -87252801 -90622875 -112602690 -113611779 -121496178 -123834792 -132951738 -138717659 -139378122 -141305166 -143410483 -151490111 -153943626 -168097205 -168899842 -175486693 -178988619 -180867479 -182000724 -187443600 -197313564 -207575941 -211603489 -212320425 -222337111 -229948277 -234100204 -241210585 -245795615 -258985688 -259276929 -263287649 -278095691 -285154139 -286161297 -287123395 -287759573 -305516942 -312709252 -325456997 -326030258 -348782086 -356669891 -356900287 -366161224 -371461690 -371926558 -395665892 -414706579 -416485383 -436984186 -452457877 -457213550 -461409220 -461430506 -479214969 -480088886 -480987540 -484077036 -494345727 -494…

Constraints:

1 <= n <= 899; -1000000000 <= a[i],x <= 1000.

Loading...
Test Cases:No test cases
No test cases available.
Emir's registers Distance Order - EASY Coding Problem | CodeTikki