solution-cf1178a
贪心,如果第 $i$ 个政党符合条件,就将它拉入联盟。
#include<bits/stdc++.h>
using namespace std;
#define int long long
int a[205];
int num[205];
signed main(){
int n;
cin>>n;
int cnt = 0;
for(int i = 1; i <= n; i++){
cin>>a[i];
cnt += a[i];
}
num[0] = 1;
int cnt2 = 0, ans = a[1];
for(int i = 2; i <= n; i++){
if(2*a[i] <= a[1]){
ans += a[i];
num[++cnt2] = i;
}
}
// cout<<ans<<' '<<cnt/2+1<<endl;
if(ans < cnt/2+1){
puts("0");
}else{
cout<<cnt2+1<<endl;
for(int i = 0; i <= cnt2; i++) cout<<num[i]<<' ';
}
return 0;
}