Embercode
✕
SortingCoding problems

Sorting: coding problems

Write a program that reads the input and prints the answer. Run checks it against every test, including hidden ones.

0 of 8 solved

  • A bakery writes down the weight of every loaf it baked today, in grams. The manager wants the list from lightest to heaviest, so the team can pack the small loaves first.

    Read the weights and print them in ascending order on one line, separated by single spaces. Equal weights are allowed.

    **Constraints:** 1 <= n <= 1500. The whole printed line must fit in 20,000 characters. Each weight is an integer from -1,000,000,000 to 1,000,000,000.

    Input. First line n. Second line n integers.

    Output. One line: the n weights in ascending order, separated by single spaces.

    Example 1 input

    5
    420 1000 380 1000 415
    

    Output

    380 415 420 1000 1000
    

    Example 2 input

    3
    -5 0 -5
    

    Output

    -5 -5 0