# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1002859 |
2024-06-19T20:52:13 Z |
hyakup |
Cigle (COI21_cigle) |
C++17 |
|
77 ms |
4692 KB |
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define bug(x) cout << #x << " " << x << endl;
#define pii pair<int, int>
const int inf = 1e9 + 10;
const int maxn = 500 + 10;
const int maxm = 3e7 + 10;
vector<int> v( maxn );
ll dp[maxn][maxn];
bool marc[maxm];
int main(){
int n; cin >> n;
for( int i = 1; i <= n; i++ ) cin >> v[i];
ll resp = 0;
for( int a = 1; a <= n; a++){
for( int b = 1; b < a; b++ ){
int sum = 0;
for( int i = b + 1; i < a; i++ ){
sum += v[i];
marc[sum] = true;
}
sum = 0;
ll& ans = dp[a][b];
int cont = 0;
for( int c = b - 1; c >= 0; c-- ){
if( marc[sum] ) cont++;
sum += v[c + 1];
ans = max( ans, dp[b][c] + cont );
}
sum = 0;
for( int i = b + 1; i < a; i++ ){
sum += v[i];
marc[sum] = false;
}
resp = max( resp, ans );
}
}
cout << resp << endl;
}
# |
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 |
0 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 |
348 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 |
0 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 |
348 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 |
1 ms |
704 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Correct |
1 ms |
604 KB |
Output is correct |
13 |
Correct |
1 ms |
604 KB |
Output is correct |
14 |
Correct |
1 ms |
604 KB |
Output is correct |
15 |
Correct |
1 ms |
600 KB |
Output is correct |
16 |
Correct |
1 ms |
856 KB |
Output is correct |
17 |
Correct |
1 ms |
604 KB |
Output is correct |
18 |
Correct |
1 ms |
604 KB |
Output is correct |
19 |
Correct |
1 ms |
604 KB |
Output is correct |
20 |
Correct |
1 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
47 ms |
2244 KB |
Output is correct |
2 |
Correct |
48 ms |
2388 KB |
Output is correct |
3 |
Correct |
49 ms |
2224 KB |
Output is correct |
4 |
Correct |
44 ms |
2176 KB |
Output is correct |
5 |
Correct |
47 ms |
2388 KB |
Output is correct |
6 |
Correct |
48 ms |
2388 KB |
Output is correct |
7 |
Correct |
48 ms |
2412 KB |
Output is correct |
8 |
Correct |
47 ms |
2380 KB |
Output is correct |
9 |
Correct |
44 ms |
2384 KB |
Output is correct |
10 |
Correct |
43 ms |
2388 KB |
Output is correct |
11 |
Correct |
44 ms |
2248 KB |
Output is correct |
12 |
Correct |
50 ms |
2324 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 |
0 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 |
348 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 |
1 ms |
704 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Correct |
1 ms |
604 KB |
Output is correct |
13 |
Correct |
1 ms |
604 KB |
Output is correct |
14 |
Correct |
1 ms |
604 KB |
Output is correct |
15 |
Correct |
1 ms |
600 KB |
Output is correct |
16 |
Correct |
1 ms |
856 KB |
Output is correct |
17 |
Correct |
1 ms |
604 KB |
Output is correct |
18 |
Correct |
1 ms |
604 KB |
Output is correct |
19 |
Correct |
1 ms |
604 KB |
Output is correct |
20 |
Correct |
1 ms |
604 KB |
Output is correct |
21 |
Correct |
47 ms |
2244 KB |
Output is correct |
22 |
Correct |
48 ms |
2388 KB |
Output is correct |
23 |
Correct |
49 ms |
2224 KB |
Output is correct |
24 |
Correct |
44 ms |
2176 KB |
Output is correct |
25 |
Correct |
47 ms |
2388 KB |
Output is correct |
26 |
Correct |
48 ms |
2388 KB |
Output is correct |
27 |
Correct |
48 ms |
2412 KB |
Output is correct |
28 |
Correct |
47 ms |
2380 KB |
Output is correct |
29 |
Correct |
44 ms |
2384 KB |
Output is correct |
30 |
Correct |
43 ms |
2388 KB |
Output is correct |
31 |
Correct |
44 ms |
2248 KB |
Output is correct |
32 |
Correct |
50 ms |
2324 KB |
Output is correct |
33 |
Correct |
53 ms |
2316 KB |
Output is correct |
34 |
Correct |
53 ms |
2392 KB |
Output is correct |
35 |
Correct |
47 ms |
2260 KB |
Output is correct |
36 |
Correct |
42 ms |
2384 KB |
Output is correct |
37 |
Correct |
45 ms |
2180 KB |
Output is correct |
38 |
Correct |
46 ms |
2388 KB |
Output is correct |
39 |
Correct |
47 ms |
2388 KB |
Output is correct |
40 |
Correct |
77 ms |
3620 KB |
Output is correct |
41 |
Correct |
70 ms |
2992 KB |
Output is correct |
42 |
Correct |
48 ms |
2396 KB |
Output is correct |
43 |
Correct |
70 ms |
3512 KB |
Output is correct |
44 |
Correct |
61 ms |
2644 KB |
Output is correct |
45 |
Correct |
54 ms |
2388 KB |
Output is correct |
46 |
Correct |
57 ms |
2388 KB |
Output is correct |
47 |
Correct |
53 ms |
2344 KB |
Output is correct |
48 |
Correct |
67 ms |
3152 KB |
Output is correct |
49 |
Correct |
57 ms |
2644 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 |
0 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 |
348 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 |
1 ms |
704 KB |
Output is correct |
11 |
Correct |
1 ms |
604 KB |
Output is correct |
12 |
Correct |
1 ms |
604 KB |
Output is correct |
13 |
Correct |
1 ms |
604 KB |
Output is correct |
14 |
Correct |
1 ms |
604 KB |
Output is correct |
15 |
Correct |
1 ms |
600 KB |
Output is correct |
16 |
Correct |
1 ms |
856 KB |
Output is correct |
17 |
Correct |
1 ms |
604 KB |
Output is correct |
18 |
Correct |
1 ms |
604 KB |
Output is correct |
19 |
Correct |
1 ms |
604 KB |
Output is correct |
20 |
Correct |
1 ms |
604 KB |
Output is correct |
21 |
Correct |
47 ms |
2244 KB |
Output is correct |
22 |
Correct |
48 ms |
2388 KB |
Output is correct |
23 |
Correct |
49 ms |
2224 KB |
Output is correct |
24 |
Correct |
44 ms |
2176 KB |
Output is correct |
25 |
Correct |
47 ms |
2388 KB |
Output is correct |
26 |
Correct |
48 ms |
2388 KB |
Output is correct |
27 |
Correct |
48 ms |
2412 KB |
Output is correct |
28 |
Correct |
47 ms |
2380 KB |
Output is correct |
29 |
Correct |
44 ms |
2384 KB |
Output is correct |
30 |
Correct |
43 ms |
2388 KB |
Output is correct |
31 |
Correct |
44 ms |
2248 KB |
Output is correct |
32 |
Correct |
50 ms |
2324 KB |
Output is correct |
33 |
Correct |
53 ms |
2316 KB |
Output is correct |
34 |
Correct |
53 ms |
2392 KB |
Output is correct |
35 |
Correct |
47 ms |
2260 KB |
Output is correct |
36 |
Correct |
42 ms |
2384 KB |
Output is correct |
37 |
Correct |
45 ms |
2180 KB |
Output is correct |
38 |
Correct |
46 ms |
2388 KB |
Output is correct |
39 |
Correct |
47 ms |
2388 KB |
Output is correct |
40 |
Correct |
77 ms |
3620 KB |
Output is correct |
41 |
Correct |
70 ms |
2992 KB |
Output is correct |
42 |
Correct |
48 ms |
2396 KB |
Output is correct |
43 |
Correct |
70 ms |
3512 KB |
Output is correct |
44 |
Correct |
61 ms |
2644 KB |
Output is correct |
45 |
Correct |
54 ms |
2388 KB |
Output is correct |
46 |
Correct |
57 ms |
2388 KB |
Output is correct |
47 |
Correct |
53 ms |
2344 KB |
Output is correct |
48 |
Correct |
67 ms |
3152 KB |
Output is correct |
49 |
Correct |
57 ms |
2644 KB |
Output is correct |
50 |
Runtime error |
46 ms |
4692 KB |
Execution killed with signal 11 |
51 |
Halted |
0 ms |
0 KB |
- |