SEAVOTE - Editorial

Can someone explain this…
if n=11 : 10 10 10 10 10 10 10 10 10 10 10
Then how the ans is “YES”… !

Was getting WA because of lower bound inequality. Changed it to strict inequality and got AC

I have big problem debugging my code

(WA) https://www.codechef.com/viewsolution/14977644
(AC) https://www.codechef.com/viewsolution/14977705

The only difference between two codes is ‘is there is break or not’
if(t > 100) {
invalid = true;
break;
}

But I think this break shouldn’t change the output because once invalid becomes true, it should print “NO” whatever the value of sum or cut is. So I don’t understand why the first code and the second code is making different output.
Can someone help me please?

My solution is not passing test case 6 and 7. Help me with a test case. A link to my


[1]


  [1]: https://ideone.com/DtkObn

Thank you.

Just see if the sum of all the elements of the array b is 100,greater than 100 or less than 100.

case 1: If it’s 100,just print YES.

case 2: If it’s less than 100,then print NO as while rounding off the elements of A will be less than(marginally) with respect to B. Hence it’s not possible to come up with any array A whose sum will be equal to 100.

case 3:If it’s greater than 100,then we have to see by how much does it exceeds 100. Then we would calculate the number of non-zero elements in the array B.Note: We calculate non-zero numbers in array B because the element 0 cannot be manipulated to anything. After that we divide the extent by which sum of elements exceeds 100 by total number of non-zero elements. That would give us the number by which we will have to decrease each element. Now we know each element cannot be decreased by more than 0.999. If the number by which we need to decrease each of the element is less than 1 ,then print YES else print NO.