QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 64 MB Total points: 100

#13305. Squarks

統計

A famous Byteotian physicist Byteasar is studying a new constituent of matter - squarks. These are quite exotic particles that never exist alone but always in pairs. Moreover, squarks of a particular kind form pairs only with squarks of different kinds.

After years of studies Byteasar has established that there are $n$ different kinds of squarks. Squarks of each kind have a unique mass, which is a positive integer multiple of (an appropriate) unit. Byteasar has also measured the total mass of each of the possible pairs of squarks. According to standard Byteotian model of physics, the mass of a pair of squarks equals the sum of the masses of the two squarks forming it.

Now Byteasar desires to determine the individual masses of squarks of every kind. He has asked your help in writing a program that will determine all solutions to this puzzle, i.e., will reconstruct all configurations of squark masses that are consistent with his previous measurements.

Input Format

In the first line of the standard input there is a single integer $n$ ($3 ≤ n ≤ 300$) that denotes the number of different kinds of squarks. In the second line there are positive integers, separated by single spaces, that denote the total masses of all possible pairs of squarks. The mass of every pair does not exceed $10^{8}$. For each two different kinds of squarks, the mass of the pair they form is given on the input exactly once. The masses on the input are given in a random order.

In tests worth $32\%$ of the points the following conditions hold in addition: $n ≤ 20$ and the mass of every pair of squarks does not exceed $2\,000$.

Output Format

In the first line of the standard output your program should print the number $k$ of possible solutions to the problem. In the $k$ lines that follow it should report successive solutions, one per line. Each solution should consist of $n$ different positive integers, namely the masses of squarks of all kinds. In every solution these should be given in increasing order and separated by single spaces.

Solutions can be reported in arbitrary order, but they cannot be repeated. You may assume that for each test data there exists at least one solution, i.e., $k > 0$.

Example

Input

4
3 5 4 7 6 5

Output

1
1 2 3 4
About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.