CF405D.Toy Sum

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

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 ss blocks in Chris's set, each block has a unique number from 1 to ss . Chris's teacher picks a subset of blocks XX and keeps it to himself. He will give them back only if Chris can pick such a non-empty subset YY from the remaining blocks, that the equality holds:

"Are you kidding me?", asks Chris.For example, consider a case where s=8s=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: (11)+(41)+(51)=(83)+(86)=7(1-1)+(4-1)+(5-1)=(8-3)+(8-6)=7 .

However, now Chris has exactly s=106s=10^{6} blocks. Given the set XX of blocks his teacher chooses, help Chris to find the required set YY !

输入格式

The first line of input contains a single integer nn ( 1<=n<=51051<=n<=5·10^{5} ), the number of blocks in the set XX . The next line contains nn distinct space-separated integers x1x_{1} , x2x_{2} , ...... , xnx_{n} ( 1<=xi<=1061<=x_{i}<=10^{6} ), the numbers of the blocks in XX .

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++.

输出格式

In the first line of output print a single integer mm ( 1<=m<=106n1<=m<=10^{6}-n ), the number of blocks in the set YY . In the next line output mm distinct space-separated integers y1y_{1} , y2y_{2} , ...... , ymy_{m} ( 1<=yi<=1061<=y_{i}<=10^{6} ), such that the required equality holds. The sets XX and YY should not intersect, i.e. xiyjx_{i}≠y_{j} for all ii , jj ( 1<=i<=n1<=i<=n ; 1<=j<=m1<=j<=m ). It is guaranteed that at least one solution always exists. If there are multiple solutions, output any of them.

输入输出样例

  • 输入#1

    3
    1 4 5
    

    输出#1

    2
    999993 1000000
  • 输入#2

    1
    1
    

    输出#2

    1
    1000000 
    
首页