# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
887217 |
2023-12-14T05:28:54 Z |
zeta7532 |
Cigle (COI21_cigle) |
C++17 |
|
1000 ms |
1684 KB |
#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
using ll = int;
const ll mod = 998244353;
#define fi first
#define se second
#define rep(i,n) for(ll i=0;i<n;i++)
#define all(x) x.begin(),x.end()
#define faster ios::sync_with_stdio(false);cin.tie(nullptr)
int main() {
ll N;
cin >> N;
vector<ll> A(N);
rep(i,N) cin >> A[i];
vector<vector<ll>> ep(N,vector<ll>(N,0));
rep(i,N){
for(ll j=i;j<N;j++){
set<ll> s;
ll cnt_l=0;
for(ll k=j;k>i;k--){
cnt_l+=A[k];
s.insert(cnt_l);
}
ll cnt=0;
ll cnt_r=0;
for(ll k=j+1;k<N;k++){
ep[j+1][k]=max(ep[j+1][k],ep[i][j]+cnt);
cnt++;
cnt_r+=A[k];
if(s.find(cnt_r)==s.end()) cnt--;
}
}
}
ll ans=0;
rep(i,N) ans=max(ans,ep[i][N-1]);
cout << ans << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
4 ms |
348 KB |
Output is correct |
11 |
Correct |
4 ms |
432 KB |
Output is correct |
12 |
Correct |
3 ms |
468 KB |
Output is correct |
13 |
Correct |
3 ms |
348 KB |
Output is correct |
14 |
Correct |
4 ms |
348 KB |
Output is correct |
15 |
Correct |
3 ms |
348 KB |
Output is correct |
16 |
Correct |
4 ms |
468 KB |
Output is correct |
17 |
Correct |
4 ms |
348 KB |
Output is correct |
18 |
Correct |
4 ms |
348 KB |
Output is correct |
19 |
Correct |
4 ms |
436 KB |
Output is correct |
20 |
Correct |
4 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
901 ms |
1436 KB |
Output is correct |
2 |
Correct |
899 ms |
1432 KB |
Output is correct |
3 |
Correct |
898 ms |
1432 KB |
Output is correct |
4 |
Correct |
912 ms |
1616 KB |
Output is correct |
5 |
Correct |
928 ms |
1436 KB |
Output is correct |
6 |
Correct |
946 ms |
1436 KB |
Output is correct |
7 |
Correct |
945 ms |
1684 KB |
Output is correct |
8 |
Correct |
949 ms |
1616 KB |
Output is correct |
9 |
Correct |
945 ms |
1436 KB |
Output is correct |
10 |
Correct |
902 ms |
1616 KB |
Output is correct |
11 |
Correct |
925 ms |
1436 KB |
Output is correct |
12 |
Correct |
906 ms |
1436 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
4 ms |
348 KB |
Output is correct |
11 |
Correct |
4 ms |
432 KB |
Output is correct |
12 |
Correct |
3 ms |
468 KB |
Output is correct |
13 |
Correct |
3 ms |
348 KB |
Output is correct |
14 |
Correct |
4 ms |
348 KB |
Output is correct |
15 |
Correct |
3 ms |
348 KB |
Output is correct |
16 |
Correct |
4 ms |
468 KB |
Output is correct |
17 |
Correct |
4 ms |
348 KB |
Output is correct |
18 |
Correct |
4 ms |
348 KB |
Output is correct |
19 |
Correct |
4 ms |
436 KB |
Output is correct |
20 |
Correct |
4 ms |
468 KB |
Output is correct |
21 |
Correct |
901 ms |
1436 KB |
Output is correct |
22 |
Correct |
899 ms |
1432 KB |
Output is correct |
23 |
Correct |
898 ms |
1432 KB |
Output is correct |
24 |
Correct |
912 ms |
1616 KB |
Output is correct |
25 |
Correct |
928 ms |
1436 KB |
Output is correct |
26 |
Correct |
946 ms |
1436 KB |
Output is correct |
27 |
Correct |
945 ms |
1684 KB |
Output is correct |
28 |
Correct |
949 ms |
1616 KB |
Output is correct |
29 |
Correct |
945 ms |
1436 KB |
Output is correct |
30 |
Correct |
902 ms |
1616 KB |
Output is correct |
31 |
Correct |
925 ms |
1436 KB |
Output is correct |
32 |
Correct |
906 ms |
1436 KB |
Output is correct |
33 |
Correct |
892 ms |
1452 KB |
Output is correct |
34 |
Correct |
892 ms |
1436 KB |
Output is correct |
35 |
Correct |
906 ms |
1432 KB |
Output is correct |
36 |
Correct |
904 ms |
1452 KB |
Output is correct |
37 |
Correct |
942 ms |
1444 KB |
Output is correct |
38 |
Correct |
944 ms |
1436 KB |
Output is correct |
39 |
Execution timed out |
1006 ms |
1428 KB |
Time limit exceeded |
40 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
344 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
4 ms |
348 KB |
Output is correct |
11 |
Correct |
4 ms |
432 KB |
Output is correct |
12 |
Correct |
3 ms |
468 KB |
Output is correct |
13 |
Correct |
3 ms |
348 KB |
Output is correct |
14 |
Correct |
4 ms |
348 KB |
Output is correct |
15 |
Correct |
3 ms |
348 KB |
Output is correct |
16 |
Correct |
4 ms |
468 KB |
Output is correct |
17 |
Correct |
4 ms |
348 KB |
Output is correct |
18 |
Correct |
4 ms |
348 KB |
Output is correct |
19 |
Correct |
4 ms |
436 KB |
Output is correct |
20 |
Correct |
4 ms |
468 KB |
Output is correct |
21 |
Correct |
901 ms |
1436 KB |
Output is correct |
22 |
Correct |
899 ms |
1432 KB |
Output is correct |
23 |
Correct |
898 ms |
1432 KB |
Output is correct |
24 |
Correct |
912 ms |
1616 KB |
Output is correct |
25 |
Correct |
928 ms |
1436 KB |
Output is correct |
26 |
Correct |
946 ms |
1436 KB |
Output is correct |
27 |
Correct |
945 ms |
1684 KB |
Output is correct |
28 |
Correct |
949 ms |
1616 KB |
Output is correct |
29 |
Correct |
945 ms |
1436 KB |
Output is correct |
30 |
Correct |
902 ms |
1616 KB |
Output is correct |
31 |
Correct |
925 ms |
1436 KB |
Output is correct |
32 |
Correct |
906 ms |
1436 KB |
Output is correct |
33 |
Correct |
892 ms |
1452 KB |
Output is correct |
34 |
Correct |
892 ms |
1436 KB |
Output is correct |
35 |
Correct |
906 ms |
1432 KB |
Output is correct |
36 |
Correct |
904 ms |
1452 KB |
Output is correct |
37 |
Correct |
942 ms |
1444 KB |
Output is correct |
38 |
Correct |
944 ms |
1436 KB |
Output is correct |
39 |
Execution timed out |
1006 ms |
1428 KB |
Time limit exceeded |
40 |
Halted |
0 ms |
0 KB |
- |