#include<iostream>
#include<algorithm>
#include<math.h>
#define MOD 1000000007
using namespace std;
long long int Data[10010];
long long int Sum[10010];
long long int ans;
long long int m_pow(long long int a, long long int b)
{
long long int s = 1;
for (long long int i = 0; i < b; i++)
s *= a;
return s;
}
int main()
{
long long int n;
cin >> n;
for (long long int i = 0; i < n; i++)
{
cin >> Data[i];
if (i == 0)Sum[i] = Data[i];
else
Sum[i] = Sum[i - 1] + Data[i];
}
long long int target = 0;
for (long long int i = 0; i < n-1; i++)
{
target += Data[i];
if ((Sum[n - 1] - Sum[i]) % target != 0)continue;
long long int zero = 0;
long long int tmp_sum = 0;
for (long long int j = i + 1; j < n; j++)
{
tmp_sum += Data[j];
if (tmp_sum == target)
tmp_sum = 0;
if (Data[j] == 0)zero++;
}
if (tmp_sum != 0)continue;
ans += m_pow(2, zero);
ans %= MOD;
}
cout << ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
2176 KB |
Output is correct |
2 |
Correct |
0 ms |
2176 KB |
Output is correct |
3 |
Correct |
0 ms |
2176 KB |
Output is correct |
4 |
Correct |
0 ms |
2176 KB |
Output is correct |
5 |
Correct |
3 ms |
2176 KB |
Output is correct |
6 |
Runtime error |
0 ms |
2176 KB |
Execution killed with signal 8 (could be triggered by violating memory limits) |
7 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
2176 KB |
Execution killed with signal 8 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |