 # Getting wrong answer in SEAVOTE

I am getting wrong answer in SEAVOTE. I know that my algorithm can lead to Time Limit Exceeded but I want to know that why it is not getting accepted even for some points (any idea for some specific test cases)? My output is correct.

The link to my code is: https://ideone.com/Z1qEIB

See the following test case:

``````1
5
0 0 0 99 3
``````

Your code gives YES while the answer is NO. Keep in mind the negative contributions of the array A. You need not put so much of logic in this question because we are dealing with real numbers. Just do the comparisons this way:

``````for(i=0;i<n;i++)
{
cin>>ele;
if(ele!=0)
sum+=(ele);
else
cnt++;
}
if(sum==100)
cout<<"YES\n";
else if(sum<100)
cout<<"NO\n";
else
{
// for all numbers as 0 and sum>100 -ve contirbution will give the minimum sum.
sum= sum- (n-cnt);
if(sum<100)
cout<<"YES\n";
else if(sum>100)
{
if((sum+cnt)<100)  // taking care of elements whose value is zero
cout<<"YES\n";
else
cout<<"NO\n";
}
else
cout<<"NO\n";
}``````