# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1033490 |
2024-07-24T22:49:59 Z |
tvladm2009 |
Cigle (COI21_cigle) |
C++17 |
|
1 ms |
600 KB |
#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define sz(a) a.size()
typedef long long ll;
const int N = 5e2 + 7;
int a[N];
int dp[N][N];
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
int n;
cin >> n;
for (int i = 0; i < n; i++)
cin >> a[i];
for (int i = 0; i < n; i++) {
for (int j = i; j < n; j++) {
int cnt = 0;
int cur = i;
int sa = 0;
int sb = 0;
for (int k = i - 1; k >= 0; k++) {
sa += a[k];
while (cur <= j && sb < sa) {
sb += a[cur];
cur++;
}
dp[i][j] = max(dp[i][j], dp[k][i - 1] + cnt);
if (sa == sb && cur <= j)
cnt++;
}
}
}
int ans = 0;
for (int i = 0; i < n; i++)
ans = max(ans, dp[i][n - 1]);
cout << ans << "\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
600 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
600 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
600 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
600 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
600 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |