Advertisement
Nusrat_Ullah

CF Global Round 4 A

Jul 20th, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. int main()
  4. {
  5.     int t,g,sum,mid,half,nt;
  6.     vector<int>re;
  7.     scanf("%d",&t);
  8.     int wq[t+3];
  9.     for(g=sum=0;g<t;g++){
  10.         scanf("%d",&wq[g]);
  11.         sum+=wq[g];
  12.     }
  13.     mid=sum>>1, half=wq[0]>>1, re.push_back(1);
  14.     for(g=nt=1,sum=wq[0];g<t;g++)
  15.         if(wq[g]<=half)
  16.             nt++, sum+=wq[g], re.push_back(g+1);
  17.     if(sum<=mid)printf("0\n");
  18.     else{
  19.         printf("%d\n",nt);
  20.         if(nt==1)printf("1\n");
  21.         else{
  22.             for(g=0;g<re.size()-1;g++)printf("%d ",re[g]);
  23.             printf("%d\n",re[g]);
  24.         }
  25.     }
  26.     return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement