Codeforces Round 238 (Div. 1)
B
Toy Sum
Codeforces
未评级
原题
← AC →
翻译中…

Little Chris is very keen on his toy blocks. His teacher, however, wants Chris to solve more problems, so he decided to play a trick on Chris.

翻译中…

There are exactly $*s*$ blocks in Chris's set, each block has a unique number from 1 to $*s*$. Chris's teacher picks a subset of blocks $*X*$ and keeps it to himself. He will give them back only if Chris can pick such a non-empty subset $*Y*$ from the remaining blocks, that the equality holds:

翻译中…

image

翻译中…

"Are you kidding me?", asks Chris.

翻译中…

For example, consider a case where $*s* = 8$ and Chris's teacher took the blocks with numbers 1, 4 and 5. One way for Chris to choose a set is to pick the blocks with numbers 3 and 6, see figure. Then the required sums would be equal: $(1 - 1) + (4 - 1) + (5 - 1) = (8 - 3) + (8 - 6) = 7$.

翻译中…

image

翻译中…

However, now Chris has exactly $*s* = 10^{6}$ blocks. Given the set $*X*$ of blocks his teacher chooses, help Chris to find the required set $*Y*$!

翻译中…

Input

翻译中…

The first line of input contains a single integer $*n*$ ($1 ≤ *n* ≤ 5·10^{5}$), the number of blocks in the set $*X*$. The next line contains $*n*$ distinct space-separated integers $*x*_{1}$, $*x*_{2}$, $...$, $*x*_{*n*}$ ($1 ≤ *x*_{*i*} ≤ 10^{6}$), the numbers of the blocks in $*X*$.

翻译中…

Note: since the size of the input and output could be very large, don't use slow output techniques in your language. For example, do not use input and output streams (cin, cout) in C++.

翻译中…

Output

翻译中…

In the first line of output print a single integer $*m*$ ($1 ≤ *m* ≤ 10^{6} - *n*$), the number of blocks in the set $*Y*$. In the next line output $*m*$ distinct space-separated integers $*y*_{1}$, $*y*_{2}$, $...$, $*y*_{*m*}$ ($1 ≤ *y*_{*i*} ≤ 10^{6}$), such that the required equality holds. The sets $*X*$ and $*Y*$ should not intersect, i.e. $*x*_{*i*} ≠ *y*_{*j*}$ for all $*i*$, $*j*$ ($1 ≤ *i* ≤ *n*$; $1 ≤ *j* ≤ *m*$). It is guaranteed that at least one solution always exists. If there are multiple solutions, output any of them.

翻译中…

样例

Input #1
3
1 4 5
Output #1
2
999993 1000000
InputCopy OutputCopy
Input #2
1
1
Output #2
1
1000000
InputCopy OutputCopy
题目信息
题号
406B
时间限制
1 s
内存限制
256 MB

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。