# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
434922 |
2021-06-22T09:38:13 Z |
dqhungdl |
Cigle (COI21_cigle) |
C++17 |
|
1000 ms |
68868 KB |
#include <bits/stdc++.h>
using namespace std;
const int MAX=5005;
int N,S[MAX],mark[MAX][MAX],f[MAX][MAX];
int main() {
#ifdef ACM
freopen("input","r",stdin);
#endif
cin>>N;
for(int i=1;i<=N;i++) {
cin>>S[i];
S[i]+=S[i-1];
}
for(int i=1;i<=N;i++) {
int cur=i;
for(int j=i+1;j<=N;j++) {
while(cur>0&&S[i]-S[cur-1]<S[j]-S[i])
cur--;
if(cur>0&&S[i]-S[cur-1]==S[j]-S[i])
mark[i][j]=cur;
}
}
for(int i=1;i<=N;i++)
for(int j=0;j<i;j++) {
int cnt=0;
for(int t=j+1;t<=N;t++) {
f[t][i]=max(f[t][i],f[i][j]+cnt);
cnt+=(mark[i][t]>j+1);
}
}
int rs=0;
for(int i=1;i<N;i++)
rs=max(rs,f[N][i]);
cout<<rs;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
460 KB |
Output is correct |
2 |
Correct |
1 ms |
460 KB |
Output is correct |
3 |
Correct |
1 ms |
460 KB |
Output is correct |
4 |
Correct |
1 ms |
460 KB |
Output is correct |
5 |
Correct |
1 ms |
460 KB |
Output is correct |
6 |
Correct |
1 ms |
460 KB |
Output is correct |
7 |
Correct |
1 ms |
300 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
460 KB |
Output is correct |
2 |
Correct |
1 ms |
460 KB |
Output is correct |
3 |
Correct |
1 ms |
460 KB |
Output is correct |
4 |
Correct |
1 ms |
460 KB |
Output is correct |
5 |
Correct |
1 ms |
460 KB |
Output is correct |
6 |
Correct |
1 ms |
460 KB |
Output is correct |
7 |
Correct |
1 ms |
300 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
332 KB |
Output is correct |
10 |
Correct |
2 ms |
972 KB |
Output is correct |
11 |
Correct |
1 ms |
844 KB |
Output is correct |
12 |
Correct |
1 ms |
972 KB |
Output is correct |
13 |
Correct |
2 ms |
940 KB |
Output is correct |
14 |
Correct |
2 ms |
972 KB |
Output is correct |
15 |
Correct |
2 ms |
972 KB |
Output is correct |
16 |
Correct |
2 ms |
588 KB |
Output is correct |
17 |
Correct |
2 ms |
800 KB |
Output is correct |
18 |
Correct |
2 ms |
812 KB |
Output is correct |
19 |
Correct |
1 ms |
716 KB |
Output is correct |
20 |
Correct |
1 ms |
716 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
93 ms |
5424 KB |
Output is correct |
2 |
Correct |
88 ms |
5444 KB |
Output is correct |
3 |
Correct |
106 ms |
5436 KB |
Output is correct |
4 |
Correct |
90 ms |
5428 KB |
Output is correct |
5 |
Correct |
92 ms |
5444 KB |
Output is correct |
6 |
Correct |
92 ms |
5496 KB |
Output is correct |
7 |
Correct |
90 ms |
5420 KB |
Output is correct |
8 |
Correct |
108 ms |
5464 KB |
Output is correct |
9 |
Correct |
107 ms |
5508 KB |
Output is correct |
10 |
Correct |
108 ms |
5516 KB |
Output is correct |
11 |
Correct |
103 ms |
5508 KB |
Output is correct |
12 |
Correct |
89 ms |
5440 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
460 KB |
Output is correct |
2 |
Correct |
1 ms |
460 KB |
Output is correct |
3 |
Correct |
1 ms |
460 KB |
Output is correct |
4 |
Correct |
1 ms |
460 KB |
Output is correct |
5 |
Correct |
1 ms |
460 KB |
Output is correct |
6 |
Correct |
1 ms |
460 KB |
Output is correct |
7 |
Correct |
1 ms |
300 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
332 KB |
Output is correct |
10 |
Correct |
2 ms |
972 KB |
Output is correct |
11 |
Correct |
1 ms |
844 KB |
Output is correct |
12 |
Correct |
1 ms |
972 KB |
Output is correct |
13 |
Correct |
2 ms |
940 KB |
Output is correct |
14 |
Correct |
2 ms |
972 KB |
Output is correct |
15 |
Correct |
2 ms |
972 KB |
Output is correct |
16 |
Correct |
2 ms |
588 KB |
Output is correct |
17 |
Correct |
2 ms |
800 KB |
Output is correct |
18 |
Correct |
2 ms |
812 KB |
Output is correct |
19 |
Correct |
1 ms |
716 KB |
Output is correct |
20 |
Correct |
1 ms |
716 KB |
Output is correct |
21 |
Correct |
93 ms |
5424 KB |
Output is correct |
22 |
Correct |
88 ms |
5444 KB |
Output is correct |
23 |
Correct |
106 ms |
5436 KB |
Output is correct |
24 |
Correct |
90 ms |
5428 KB |
Output is correct |
25 |
Correct |
92 ms |
5444 KB |
Output is correct |
26 |
Correct |
92 ms |
5496 KB |
Output is correct |
27 |
Correct |
90 ms |
5420 KB |
Output is correct |
28 |
Correct |
108 ms |
5464 KB |
Output is correct |
29 |
Correct |
107 ms |
5508 KB |
Output is correct |
30 |
Correct |
108 ms |
5516 KB |
Output is correct |
31 |
Correct |
103 ms |
5508 KB |
Output is correct |
32 |
Correct |
89 ms |
5440 KB |
Output is correct |
33 |
Correct |
89 ms |
5516 KB |
Output is correct |
34 |
Correct |
114 ms |
5400 KB |
Output is correct |
35 |
Correct |
93 ms |
5472 KB |
Output is correct |
36 |
Correct |
89 ms |
5444 KB |
Output is correct |
37 |
Correct |
92 ms |
5420 KB |
Output is correct |
38 |
Correct |
98 ms |
5452 KB |
Output is correct |
39 |
Correct |
95 ms |
5444 KB |
Output is correct |
40 |
Correct |
114 ms |
3320 KB |
Output is correct |
41 |
Correct |
90 ms |
4324 KB |
Output is correct |
42 |
Correct |
97 ms |
4976 KB |
Output is correct |
43 |
Correct |
95 ms |
4532 KB |
Output is correct |
44 |
Correct |
90 ms |
3640 KB |
Output is correct |
45 |
Correct |
92 ms |
4548 KB |
Output is correct |
46 |
Correct |
99 ms |
4316 KB |
Output is correct |
47 |
Correct |
89 ms |
3936 KB |
Output is correct |
48 |
Correct |
94 ms |
4272 KB |
Output is correct |
49 |
Correct |
93 ms |
4532 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
460 KB |
Output is correct |
2 |
Correct |
1 ms |
460 KB |
Output is correct |
3 |
Correct |
1 ms |
460 KB |
Output is correct |
4 |
Correct |
1 ms |
460 KB |
Output is correct |
5 |
Correct |
1 ms |
460 KB |
Output is correct |
6 |
Correct |
1 ms |
460 KB |
Output is correct |
7 |
Correct |
1 ms |
300 KB |
Output is correct |
8 |
Correct |
1 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
332 KB |
Output is correct |
10 |
Correct |
2 ms |
972 KB |
Output is correct |
11 |
Correct |
1 ms |
844 KB |
Output is correct |
12 |
Correct |
1 ms |
972 KB |
Output is correct |
13 |
Correct |
2 ms |
940 KB |
Output is correct |
14 |
Correct |
2 ms |
972 KB |
Output is correct |
15 |
Correct |
2 ms |
972 KB |
Output is correct |
16 |
Correct |
2 ms |
588 KB |
Output is correct |
17 |
Correct |
2 ms |
800 KB |
Output is correct |
18 |
Correct |
2 ms |
812 KB |
Output is correct |
19 |
Correct |
1 ms |
716 KB |
Output is correct |
20 |
Correct |
1 ms |
716 KB |
Output is correct |
21 |
Correct |
93 ms |
5424 KB |
Output is correct |
22 |
Correct |
88 ms |
5444 KB |
Output is correct |
23 |
Correct |
106 ms |
5436 KB |
Output is correct |
24 |
Correct |
90 ms |
5428 KB |
Output is correct |
25 |
Correct |
92 ms |
5444 KB |
Output is correct |
26 |
Correct |
92 ms |
5496 KB |
Output is correct |
27 |
Correct |
90 ms |
5420 KB |
Output is correct |
28 |
Correct |
108 ms |
5464 KB |
Output is correct |
29 |
Correct |
107 ms |
5508 KB |
Output is correct |
30 |
Correct |
108 ms |
5516 KB |
Output is correct |
31 |
Correct |
103 ms |
5508 KB |
Output is correct |
32 |
Correct |
89 ms |
5440 KB |
Output is correct |
33 |
Correct |
89 ms |
5516 KB |
Output is correct |
34 |
Correct |
114 ms |
5400 KB |
Output is correct |
35 |
Correct |
93 ms |
5472 KB |
Output is correct |
36 |
Correct |
89 ms |
5444 KB |
Output is correct |
37 |
Correct |
92 ms |
5420 KB |
Output is correct |
38 |
Correct |
98 ms |
5452 KB |
Output is correct |
39 |
Correct |
95 ms |
5444 KB |
Output is correct |
40 |
Correct |
114 ms |
3320 KB |
Output is correct |
41 |
Correct |
90 ms |
4324 KB |
Output is correct |
42 |
Correct |
97 ms |
4976 KB |
Output is correct |
43 |
Correct |
95 ms |
4532 KB |
Output is correct |
44 |
Correct |
90 ms |
3640 KB |
Output is correct |
45 |
Correct |
92 ms |
4548 KB |
Output is correct |
46 |
Correct |
99 ms |
4316 KB |
Output is correct |
47 |
Correct |
89 ms |
3936 KB |
Output is correct |
48 |
Correct |
94 ms |
4272 KB |
Output is correct |
49 |
Correct |
93 ms |
4532 KB |
Output is correct |
50 |
Execution timed out |
1093 ms |
68868 KB |
Time limit exceeded |
51 |
Halted |
0 ms |
0 KB |
- |