Submit | All submissions | Best solutions | Back to list |
MAKESUM - MAKESUM |
Pairwise sums of n numbers (i.e. NC2 sums) are given in sorted order.
You need to identify the numbers and print then. If there are several solutions print the lexicographically smallest one.
The Output should have natural numbers only.
Input
NC2 <= 50
NC2 numbers each <= 10^5
Output
lexicographically smallest set of numbers
Example
Input: 1 2 Output: 1 1
Input: 3 2 2 2 Output: 1 1 1
Input: 6 2 2 2 3 3 3 Output: 1 1 1 2
Input: 1 4 Output: 1 3
Here 2 2 and 3 1 are also possible solutions but we have to print the lexicographically smallest one.
Added by: | priyamehtanit |
Date: | 2012-06-01 |
Time limit: | 0.201s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
Resource: | own |
hide comments
2013-02-05 18:58:48 Prof_Utonium_ಉಮೆಶ್
I think one of the test cases has a newline in first line. If writing in Java, use Scanner to read input. |
|
2012-06-26 23:50:45 priyamehtanit
Thanks a lot.. for your comments :) |
|
2012-06-24 22:48:03 যোবায়ের
nice one :) |
|
2012-06-21 18:30:55 Massand Sagar Sunil
Can nc2 be equal to 5 or 4? |
|
2012-06-01 18:28:28 :D
Fun problem. I could have used a bigger constrains version. My algo was pretty clunky. It would be nice to see how it fairs against other ones with harder test data. |