Three baskets in weight order
Statement
A fruit shop splits the fruit for a customer across three baskets. After filling them, the shop weighs the three baskets on a scale in order, and writes them into the ledger from the lightest basket on. The ledger holds only the weights, on one line, and not the basket numbers.
Given the weights of the three baskets, write a program that prints them in order from the lightest.
For example, suppose the weights of the three baskets are as in the table below. The weights of baskets 1, 2, and 3 are written in the order they went on the scale.
| Basket | 1 | 2 | 3 |
|---|---|---|---|
| Weight | 83 | 515 | 45 |
The lightest of them is basket 3, whose weight is 45. Next comes basket 1, whose weight is 83, and the heaviest is basket 2, whose weight is 515. So the order written into the ledger is the following.
| Order | 1 | 2 | 3 |
|---|---|---|---|
| Basket | 3 | 1 | 2 |
| Weight | 45 | 83 | 515 |
So in this case 45, 83, and 515 are printed on one line in that order.
As here, the order of weighing and the order written into the ledger can differ. The weights of the three baskets are sometimes given from the heaviest. For example, suppose the weights are as in the table below.
| Basket | 1 | 2 | 3 |
|---|---|---|---|
| Weight | 1000 | 999 | 998 |
The order written into the ledger is then 998, 999, 1000. It is the order of weighing turned around.
| Order | 1 | 2 | 3 |
|---|---|---|---|
| Basket | 3 | 2 | 1 |
| Weight | 998 | 999 | 1000 |
If the weights of the three baskets are already given from the lightest, the given order is written as it is.
Input and Output Examples
Example 1
Input
83 515 45
Output
45 83 515
Example 2
Input
3 1 2
Output
1 2 3
Example 3
Input
1000 999 998
Output
998 999 1000
Input
First, the first line gives the weights of the three baskets in order, separated by one space. Each weight is a natural number between 1 and 1,000. Also, the weights of the three baskets are all different. The order the weights are given in is the order of the basket numbers, and it has nothing to do with the order of their sizes.
Output
Print the weights of the three baskets on one line, in order from the lightest. Attach one space after each weight as you print it. One space is therefore left after the last weight on the line as well. After that space, finish with one line break. Grading weighs your output against the expected value down to the last character, so a missing space at the end of the line is treated as a wrong answer even when you got the order right. When a line holds more than one value, the values are separated by a single space.
Requirements
- Read the input from standard input and write the result to standard output
- Print the weights in order from the lightest
- Print the result on one line
- Grading weighs your output against the expected value down to the last character
- You must write a program that reads from standard input and writes to standard output
- Trailing spaces at the end of a line and blank lines at the end of the output are ignored when grading
- The languages you can use are Python and JavaScript
- The memory limit is 256MB. The browser does not measure it, it only states it
- The time limit is set by measuring the setter's reference solution on the same runtime
- On this problem you submit code, not a prompt. That code runs in the browser on this device, and all that goes to the server is a fingerprint of the output and the time it took. Whether it is correct is decided by the server. The run time is a number each device reports, so the code and the device details are posted next to it on the leaderboard.
- The output has to match the expected value down to the character. A space inside a line counts the same as any other character.
- There are 15 cases, and 3 of them show the input together with the expected output. The rest are used only when you submit and are not shown on this page.
- You have to pass all 15 cases to solve this.
Examples
3 public cases. Judging also uses hidden cases. You have to pass all 15 cases to solve this.
3 1 2
1 2 3
1000 999 998
998 999 1000
83 515 45
45 83 515
Solution
Your code runs on this device. Only the fingerprint of the output and the elapsed time go to the server. The server decides whether it is correct.
Submitting requires you to log in. Running against the public cases works without one.
You can test with 3 public cases. Submitting runs the hidden cases too.
People who solved this problem
Nobody yet. You could be the first.