CF1178A Prime Minister

题目描述

Alice是改革党的领导者,而她即将成为国家主席。 大选刚刚结束,一共有$n$个政党参与大选,每一个政党在大选中获得了$a_i$张选票。 Alice的政党的编号是1。为了成为主席,她需要结成一个包括自己的政党与若干其他政党的联盟。这个联盟需要满足以下几个条件: - 这个联盟中的政党的总票数必须是全部票数的严格多数,也即,这个联盟的总票数必须严格大于总票数的一半。例如,若总票数为200或201,那么严格多数即为101票及以上。 - Alice的政党所拥有的选票必须至少是联盟中任意其他政党的两倍。例如,若Alice想要邀请一个拥有50票的政党进入联盟,那么Alice的政党就必须要有至少100票。 例如,若$n=4$且$a=[51,25,99,25]$,那么Alice就可以将$[a_1=51,a_2=25,a_4=25]$组成一个联盟。

输入格式

第一行为$n$. 第二行有$n$个数,第$i$个数即为$a_i$。

输出格式

如果无法组成符合要求的联盟,则输出0。 否则,第一行输出联盟内的政党数,第二行输出联盟包含的政党的编号。

说明/提示

In the first example, Alice picks the second party. Note that she can also pick the third party or both of them. However, she cannot become prime minister without any of them, because $ 100 $ is not a strict majority out of $ 200 $ . In the second example, there is no way of building a majority, as both other parties are too large to become a coalition partner. In the third example, Alice already has the majority. The fourth example is described in the problem statement.