CT23610

Forester's vials Reckoning

EasyL3 · Syntax SurferAcceptance: 0.0%XP: 20

Forester found an old ledger of vials in the lighthouse attic at the ivory gates of Alabast. The margin notes pose a precise question. 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 <= 735; -1000000 <= a[i],x <= 1000000000.

Example 1:

Input: 87 380823673 801927581 463851072 7930259 976162317 673139854 366888837 882064802 496188495 683352147 674575202 212978816 344138240 147532237 112589305 72574653 253083941 766155252 126815945 627309673 65071267 300166042 771441646 2799038 867941470 750374478 291240566 848403702 432954050 108522327 961215442 393131754 771406349 768423037 591338374 960615973 992219281 197669883 438823631 330767365 974842009 648522417 315621546 330466951 34401504 395146885 709647480 251076899 449601338 243935199 912269664 265864624 100543549 707548242 361962392 610495329 754390286 805098333 648966210 285863132 746239266 331114843 109670559 11049188 22787209 113569039 188727771 962774514 109576180 366818667 36746369 910110108 344817965 170662751 292291854 4713900 482805582 105617692 793759358 765211334 647724960…
Output: 2799038 4713900 7930259 11049188 22787209 34401504 36746369 58272500 65071267 72574653 100543549 105617692 108522327 109576180 109670559 112589305 113569039 126815945 147532237 170662751 177231810 188727771 196521833 197669883 212978816 243935199 251076899 253083941 265864624 285863132 291240566 292291854 300166042 315621546 330466951 330767365 331114843 344138240 344817965 361962392 366818667 366888837 380823673 393131754 395146885 432954050 438823631 449601338 463851072 482805582 496188495 560905540 576314972 591338374 610495329 627309673 647724960 648522417 648966210 673139854 674575202 683352147 707548242 709647480 720727942 746239266 750374478 754390286 765211334 766155252 768423037 771406349 771441646 793759358 801927581 805098333 848403702 867941470 882064802 910110108 912269664 960…

Example 2:

Input: 378 844171898 255720714 392844451 710233755 551982378 971125920 349125590 666589199 813542041 873141205 52504438 148435988 714396503 765216883 664468421 114319600 934360476 890259443 430892997 375094 439662188 925327494 18833828 485401535 211937218 163219638 972015635 384102089 512370601 631946801 338665729 496230057 373087505 500229409 391192824 75724875 678944714 776460902 504573092 758280274 141729492 753117683 397339716 470094421 402034206 436875814 921978586 833450830 303238164 173336218 541989433 303098102 702271160 229352607 759949732 6006668 42405004 929219920 454466044 717167622 209916429 924295768 906884546 408806066 589972381 587539840 254453635 286602390 242872603 976201525 598164704 141447313 269842184 214256356 861068155 60553531 689626287 151798970 122156594 864934499 507022…
Output: 375094 6006668 13255140 15232067 16991680 18786143 18833828 20701425 20932733 21333821 21667276 23262509 25620973 27040152 28807459 39908136 41534855 42258229 42405004 43885423 44178597 45259217 45637786 47170369 47344752 47767372 49855415 51365444 52504438 60002657 60222573 60553531 70008508 75042235 75724875 89079380 93725538 99160249 102745323 105417212 108489262 109383644 110080970 110903163 111244296 112717571 114319600 115493107 115944073 118475941 118479590 119537210 120038880 120128350 122156594 123250813 129271590 134522594 135136612 135488655 136818961 141447313 141729492 146192419 148435988 149729339 150091076 151798970 152631004 155597209 160138879 163219638 163307629 164544478 165918505 167350415 173336218 179204844 179816141 180147536 183028058 183579149 188920808 194990540 1…

Example 3:

Input: 255 161016520 660724862 918359854 325600328 814353416 445541379 965315104 976867736 421412908 15746842 921342893 530759528 824432864 676480741 922045739 809858365 988202823 78415334 792560089 926358236 150360042 341046332 31201286 759894610 799203428 8809290 791283067 298065013 295193089 913056710 553461694 785496460 994364708 148601716 531610561 683792943 267770924 328113845 465403100 782381062 255523200 339475005 330774372 683747502 611833372 295289178 904490925 462833973 113147441 957607088 806100494 482401212 289396884 131502597 392109211 806269165 814199388 559683462 639694890 264549299 816403884 56202490 453767834 122021205 252351162 516345787 838602211 281816755 978750384 914353372 841625895 682228252 198500648 255558473 131315939 303785690 530010988 16300213 65919109 775745767 7697…
Output: 1669898 5969077 8042917 8556621 8809290 12673281 15394217 15746842 16300213 17460806 24975873 25064120 28733461 31201286 31329846 36373227 49335486 50625269 56202490 57781574 65919109 66210491 73464288 76754986 78415334 80017922 83907221 84924379 89931411 107363463 108774138 113147441 116657058 118569445 120227832 122021205 123843136 131315939 131502597 143350069 147239491 148601716 150360042 159729127 161016520 164855342 175034486 177334492 178400695 180915863 181982619 183160091 184205107 193926515 194615181 197034503 198500648 200943485 202899864 207428724 211498304 222645992 234340628 236821354 244481230 251764596 252351162 254060091 255523200 255558473 261167554 264549299 267770924 271276346 281477487 281816755 283456842 283703494 289396884 289544411 293789757 295096065 295193089 2952…

Constraints:

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

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