CF1077C Good Array

题目描述

一个序列是好的当且仅当有一个数是其它所有数的和,比如$a=[1,3,3,7]$中$7=1+3+3$,所以这个序列是好的。 给你长度为$n$的序列$a$,你的任务是输出所有的$j$使得去掉$a_j$后的序列是好的。 举例,$a=[8,3,5,2]$,答案是$1$和$4$ - 如果你去掉$a_1$,剩下$[3,5,2]$,是好的 - 如果你去掉$a_4$,剩下$[8,3,5]$,是好的 你需要**独立地**检查所有项。比方说你去掉这个数,然后检查剩下的序列是否是好的,然后再放回去。

输入格式

第一行一个整数$n(1\le n\le 2\times 10^5)$ 第二行$n$个整数$a_1, a_2, ..., a_n(1\le a_i\le 10^6)$

输出格式

第一行输出一个整数$k$,表示答案的个数 接下来一行$k$个整数$j_1, j_2, ..., j_k$,可以以任意顺序输出,表示答案 如果没有$j$满足要求,第一行输出$0$,然后让第二行为空。

说明/提示

In the first example you can remove any element with the value $ 2 $ so the array will look like $ [5, 1, 2, 2] $ . The sum of this array is $ 10 $ and there is an element equals to the sum of remaining elements ( $ 5 = 1 + 2 + 2 $ ). In the second example you can remove $ 8 $ so the array will look like $ [3, 5, 2] $ . The sum of this array is $ 10 $ and there is an element equals to the sum of remaining elements ( $ 5 = 3 + 2 $ ). You can also remove $ 2 $ so the array will look like $ [8, 3, 5] $ . The sum of this array is $ 16 $ and there is an element equals to the sum of remaining elements ( $ 8 = 3 + 5 $ ). In the third example you cannot make the given array good by removing exactly one element.