Division of cats
Limits: 2 sec., 256 MiB
This statement was translated automatically from Ukrainian.
Zenyk and Marichka recently bought \(n\) new cats in Auchan. It is known that the \(i\)-th cat weighs \(a_i\) kilograms.
Now our heroes want to divide these cats among themselves. The main thing for them is that the expenses for these cats are distributed equally between the friends. Since the expenses for a cat are proportional to its weight, they want to divide the cats so that the total weight of Zenyk’s cats is equal to the total weight of Marichka’s cats.
Your task is to help them find the desired division.
Input
The first line gives a single integer \(n\) — the number of cats.
The second line gives \(n\) integers \(a_i\) — the weights of the respective cats.
The cats are numbered with integers from 1 to \(n\) inclusive.
Output
If it is impossible to divide the cats correctly, output a single
number -1.
Otherwise, in the first line output the number \(k\) — the number of cats that Zenyk will get.
In the second line output a sequence of \(k\) integers — the indices of Zenyk’s cats. All other cats will be received by Marichka.
If there are several correct distributions, you are allowed to output any of them.
Constraints
\(1 \le n \le 200\),
\(1 \le a_i \le 4\),
\(40\%\) of tests: \(n \le 20\).
Samples
| Input (stdin) | Output (stdout) |
|---|---|
| 5 4 1 4 3 4 | 3 1 2 4 |
Submit a solution
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|
| Element Type | Created | Who | Problem | Compiler | Result | Time (sec.) | Memory (MiB) | # | Actions |
|---|