CT25234

Indu's Distance Order Ledger

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Indu inherited the cellar at the pearl fisheries of Nacre Bay along with its curious bookkeeping system for weights. Time to make sense of it. 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 <= 840; -1000000000 <= a[i],x <= 1000000.

Example 1:

Input: 223 -837804029 -18524746 -251900601 -865057661 -662424861 -820396568 -968208332 -882732803 -479881142 -618275556 -313182910 -46569932 -855807293 -244042982 -760510821 -953649592 -899845566 -356757590 -430087872 -60384744 -820959336 -585321691 -869058007 -350996342 -806949161 -179267930 -215222930 -160269430 -417020181 -79924757 -801513019 -200198384 -1472159 -373138952 -337900072 -633523127 -975418795 -861613376 -613045024 -753392587 -354726809 -601179218 -852272976 -950562817 -160336636 -745379342 -173840797 -775732505 -265917026 -22748995 -546839480 -421256826 -368779917 -843962125 -35439810 -839417726 -238349376 -138807627 -689034259 -844700177 -964088664 -194303689 -220427671 -363626184 -940044727 -151300219 -602905178 -285192243 -529487463 -723440328 -327049986 -491424260 -216299664 -…
Output: -1167647 -1472159 -7388765 -8894476 -9767054 -11101877 -14714999 -18524746 -20380151 -22748995 -35439810 -36348936 -38811655 -46569932 -51623129 -51846592 -58563775 -60384744 -61626396 -70257716 -70820125 -72008390 -72874033 -73078753 -79924757 -81828858 -93697301 -101025980 -103161824 -105636049 -109306116 -109733474 -110564880 -116916906 -119768510 -126591880 -127291065 -134613365 -138807627 -148139896 -151300219 -160269430 -160336636 -161219839 -168177777 -170228975 -173840797 -179267930 -194303689 -200198384 -205360014 -210257598 -211726989 -213456838 -215222930 -216299664 -220427671 -231462627 -235459477 -238349376 -244042982 -246407668 -251063823 -251900601 -259504540 -265741289 -265917026 -281358901 -283324514 -284952728 -285192243 -295643718 -297618424 -303922779 -305149358 -305662…

Example 2:

Input: 244 -615313102 -816671682 -839963775 -453336670 -274889448 -56714137 -669633414 -888218707 -621239246 -677407539 -830091233 -558632970 -158680880 -282233280 -920246672 -87319172 -149956350 -294134341 -329571773 -842896503 -454034658 -762869220 -683402298 -351238616 -205419791 -430660837 -675053748 -55703988 -645495069 -432769720 -187330619 -984004151 -385834764 -341766825 -569697897 -963502534 -738080657 -816167436 -319665546 -832192003 -51201631 -764609248 -387650559 -615484051 -737509170 -823893407 -814237178 -92453063 -647771746 -670784263 -616760348 -679583089 -79639790 -664021388 -533451478 -668086793 -720650314 -428330681 -542593345 -827914442 -530377136 -572222204 -48849720 -185263563 -679152400 -259659003 -945339490 -978657931 -384738325 -648303106 -312099938 -523705446 -908284110 …
Output: -3292120 -8114950 -24075985 -27741699 -32911355 -33218328 -33688409 -35089891 -46158767 -46837408 -48849720 -50813473 -51201631 -55703988 -56714137 -61441107 -74756476 -76507783 -78142337 -79639790 -87319172 -88779752 -92453063 -97416683 -103825690 -120483468 -126567178 -131580299 -135838411 -149956350 -158680880 -161192006 -169383561 -181251282 -185263563 -187330619 -187846849 -190043713 -190928107 -194111986 -202636324 -202809425 -205419791 -206429623 -207799996 -208653465 -243267757 -246703409 -251535620 -258923198 -259659003 -260937468 -265605036 -272991874 -274447853 -274889448 -282233280 -294134341 -303795336 -305051133 -312099938 -319665546 -322339874 -327497776 -329571773 -336986088 -341766825 -342444339 -348009712 -348308504 -351238616 -357384646 -360182998 -362068635 -368840189 -…

Example 3:

Input: 303 -980914959 -428675013 -722475444 -38267732 -53622952 -841714024 -242587215 -117511059 -322221226 -616369239 -161042833 -124804613 -512107971 -70361371 -503905076 -130951079 -345533807 -230331219 -751680101 -332987302 -925518182 -404753805 -34767480 -933257999 -169268578 -178744200 -131537200 -15949128 -761057780 -694379647 -858596007 -537451468 -510794526 -457226750 -115518768 -752971873 -689213530 -558740769 -221634072 -419143738 -646966428 -619034320 -718189559 -320119091 -654601946 -763662037 -36506798 -356109790 -387699338 -304453646 -723083774 -365348219 -578675000 -941439750 -127944408 -189633892 -816720766 -695774362 -897005755 -524188821 -344533818 -908991555 -555127010 -779450382 -367523768 -318721528 -967672082 -298876043 -601595809 -214846291 -213489266 -848331473 -921897527…
Output: -3278278 -5425432 -6121906 -10327377 -15949128 -19284690 -20187404 -21033291 -21320779 -25372031 -34767480 -36126422 -36506798 -37170298 -38267732 -38655703 -42379471 -42427647 -42894016 -50499347 -53622952 -53826719 -55544742 -59654630 -70361371 -81800002 -82385063 -85104293 -95052973 -99424949 -100729507 -101936661 -103007612 -109205425 -115518768 -116017707 -117084569 -117511059 -120787946 -121974004 -124365505 -124804613 -127944408 -130951079 -131537200 -133963895 -135495476 -135837933 -143117676 -147200612 -156064017 -160030916 -161042833 -162825955 -166250420 -169268578 -169755172 -178744200 -179016581 -179827565 -187213038 -189174743 -189633892 -194725606 -198037842 -200445197 -202703839 -205625222 -213489266 -214846291 -215873888 -221634072 -221825567 -224729892 -230331219 -2348478…

Constraints:

1 <= n <= 840; -1000000000 <= a[i],x <= 1000000.

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