8395: Counting Friends

内存限制:128 MB 时间限制:1 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:1 通过:1

题目描述

Farmer John's N cows (2 <= N <= 500) have joined the social network "MooBook". Each cow has one or more friends with whom they interact on MooBook. Just for fun, Farmer John makes a list of the number of friends for each of his cows, but during the process of writing the list he becomes distracted, and he includes one extra number by mistake (so his list contains N+1 numbers, instead of N numbers as he intended). Please help Farmer John figure out which numbers on his list could have been the erroneous extra number.
农民约翰的N头牛(2头<=N<=500头)加入了社交网络“MooBook”。



每头牛都有一个或多个朋友,他们可以在MooBook上与之互动。只是

为了好玩,农夫约翰列出了他每个人的朋友数量

奶牛,但在写名单的过程中,他变得心烦意乱

他错误地加入了一个额外的数字(因此他的列表包含N+1个数字,

而不是他想要的N个数字)。



请帮助农夫约翰找出他名单上可能有哪些数字

是错误的额外号码。


输入格式

* Line 1: The integer N. * Lines 2..2+N: Line i+1 contains the number of friends for one of FJ's cows, or possibly the extra erroneous number.
Farmer John has 4 cows. Two cows have only 1 friend each, two cows have 2 friends each, and 1 cow has 3 friends (of course, one of these numbers is extra and does not belong on the list).




输出格式

* Line 1: An integer K giving the number of entries in FJ's list that could be the extra number (or, K=0 means that there is no number on the list whose removal yields a feasible pairing of friends). * Lines 2..1+K: Each line contains the index (1..N+1) within the input ordering of a number of FJ's list that could potentially be the extra number -- that is, a number that can be removed such that the remaining N numbers admit a feasible set of friendships among the cows. These lines should be in sorted order.
Removal of the first number in FJ's list (the number 1) gives a remaining list of 2,2,1,3, which does lead to a feasible friendship pairing -- for example, if we name the cows A..D, then the pairings (A,B), (A,C), (A,D), and (B,C) suffice, since A has 3 friends, B and C have 2 friends, and D has 1 friend. Similarly, removing the other "1" from FJ's list also works, and so does removing the "3" from FJ's list. Removal of either "2" from FJ's list does not work -- we can see this by the fact that the sum of the remaining numbers is odd, which clearly prohibits us from finding a feasible pairing.

输入样例 复制

4
1
2
2
1
3

输出样例 复制

3
1
4
5