int total(const vector<int> &A){ int ret = 0; for (size_t i = 0; i < A.size(); ++i) ret += A; return ret;}int equi ( const vector<int> &A ) { if (A.empty()) return -1; if (A.size() == 1) return 0; int right = total(A); int left = 0; for (size_t i = 0; i < A.size(); ++i) { right -= A; if (left == right) return i; left += A; } return -1;}
I got a 94 because it failed one of the tests:
Quote:
extreme_large_numbers
Sequence with extremly large numbers testing arithmetic overflow. 0.004 s. WRONG ANSWER
got 2, but it is not equilibrium point, sum[0..1]=4294967294, sum[3..3]=-2
I didn't think to test for overflow, that is such an obscure case [wow]... Python doesn't have that issue, does it?