Submission #1096874

# Submission time Handle Problem Language Result Execution time Memory
1096874 2024-10-05T10:09:01 Z Muhammet Bigger segments (IZhO19_segments) C++17
37 / 100
1500 ms 87644 KB
#include <bits/stdc++.h>

using namespace std;

int main(){
	int n;
	cin >> n;
	vector <long long> a(n+1), p(n+1, 0);
	for(int i = 1; i <= n; i++){
		cin >> a[i];
		p[i] = p[i-1] + a[i];
	}
	vector <vector <long long>> v, v1;
	v.resize(n+1);
	v1.resize(n+1);
	for(int i = 1; i <= n; i++){
		long long s = 0;
		for(int j = i-1; j >= 1; j--){
			s += a[j+1];
			int t = upper_bound(v[j].begin(), v[j].end(), s) - v[j].begin();
			if(t != 0){
				v[i].push_back(s);
				v1[i].push_back(v1[j][t-1]+1);
 			}
		}
		s += a[1];
		v[i].push_back(s);
		v1[i].push_back(1);
		for(int j = 1; j < (int)v1[i].size(); j++){
			v1[i][j] = max(v1[i][j],v1[i][j-1]);
		}
	}
	cout << v1[n].back();
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 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 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 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 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 3 ms 2652 KB Output is correct
18 Correct 5 ms 2792 KB Output is correct
19 Correct 4 ms 2908 KB Output is correct
20 Correct 3 ms 3000 KB Output is correct
21 Correct 4 ms 2928 KB Output is correct
22 Correct 3 ms 2096 KB Output is correct
23 Correct 2 ms 1112 KB Output is correct
24 Correct 4 ms 2908 KB Output is correct
25 Correct 4 ms 2908 KB Output is correct
26 Correct 3 ms 2908 KB Output is correct
27 Correct 3 ms 2140 KB Output is correct
28 Correct 3 ms 2908 KB Output is correct
29 Correct 3 ms 2908 KB Output is correct
30 Correct 4 ms 2980 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 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 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 3 ms 2652 KB Output is correct
18 Correct 5 ms 2792 KB Output is correct
19 Correct 4 ms 2908 KB Output is correct
20 Correct 3 ms 3000 KB Output is correct
21 Correct 4 ms 2928 KB Output is correct
22 Correct 3 ms 2096 KB Output is correct
23 Correct 2 ms 1112 KB Output is correct
24 Correct 4 ms 2908 KB Output is correct
25 Correct 4 ms 2908 KB Output is correct
26 Correct 3 ms 2908 KB Output is correct
27 Correct 3 ms 2140 KB Output is correct
28 Correct 3 ms 2908 KB Output is correct
29 Correct 3 ms 2908 KB Output is correct
30 Correct 4 ms 2980 KB Output is correct
31 Correct 9 ms 808 KB Output is correct
32 Correct 131 ms 68500 KB Output is correct
33 Correct 203 ms 86260 KB Output is correct
34 Correct 138 ms 72784 KB Output is correct
35 Correct 193 ms 87528 KB Output is correct
36 Correct 221 ms 85584 KB Output is correct
37 Correct 155 ms 60496 KB Output is correct
38 Correct 87 ms 39760 KB Output is correct
39 Correct 215 ms 85844 KB Output is correct
40 Correct 220 ms 85844 KB Output is correct
41 Correct 169 ms 87644 KB Output is correct
42 Correct 147 ms 76952 KB Output is correct
43 Correct 148 ms 71248 KB Output is correct
44 Correct 188 ms 87544 KB Output is correct
45 Correct 196 ms 87376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 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 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 3 ms 2652 KB Output is correct
18 Correct 5 ms 2792 KB Output is correct
19 Correct 4 ms 2908 KB Output is correct
20 Correct 3 ms 3000 KB Output is correct
21 Correct 4 ms 2928 KB Output is correct
22 Correct 3 ms 2096 KB Output is correct
23 Correct 2 ms 1112 KB Output is correct
24 Correct 4 ms 2908 KB Output is correct
25 Correct 4 ms 2908 KB Output is correct
26 Correct 3 ms 2908 KB Output is correct
27 Correct 3 ms 2140 KB Output is correct
28 Correct 3 ms 2908 KB Output is correct
29 Correct 3 ms 2908 KB Output is correct
30 Correct 4 ms 2980 KB Output is correct
31 Correct 9 ms 808 KB Output is correct
32 Correct 131 ms 68500 KB Output is correct
33 Correct 203 ms 86260 KB Output is correct
34 Correct 138 ms 72784 KB Output is correct
35 Correct 193 ms 87528 KB Output is correct
36 Correct 221 ms 85584 KB Output is correct
37 Correct 155 ms 60496 KB Output is correct
38 Correct 87 ms 39760 KB Output is correct
39 Correct 215 ms 85844 KB Output is correct
40 Correct 220 ms 85844 KB Output is correct
41 Correct 169 ms 87644 KB Output is correct
42 Correct 147 ms 76952 KB Output is correct
43 Correct 148 ms 71248 KB Output is correct
44 Correct 188 ms 87544 KB Output is correct
45 Correct 196 ms 87376 KB Output is correct
46 Execution timed out 1577 ms 9444 KB Time limit exceeded
47 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 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 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 3 ms 2652 KB Output is correct
18 Correct 5 ms 2792 KB Output is correct
19 Correct 4 ms 2908 KB Output is correct
20 Correct 3 ms 3000 KB Output is correct
21 Correct 4 ms 2928 KB Output is correct
22 Correct 3 ms 2096 KB Output is correct
23 Correct 2 ms 1112 KB Output is correct
24 Correct 4 ms 2908 KB Output is correct
25 Correct 4 ms 2908 KB Output is correct
26 Correct 3 ms 2908 KB Output is correct
27 Correct 3 ms 2140 KB Output is correct
28 Correct 3 ms 2908 KB Output is correct
29 Correct 3 ms 2908 KB Output is correct
30 Correct 4 ms 2980 KB Output is correct
31 Correct 9 ms 808 KB Output is correct
32 Correct 131 ms 68500 KB Output is correct
33 Correct 203 ms 86260 KB Output is correct
34 Correct 138 ms 72784 KB Output is correct
35 Correct 193 ms 87528 KB Output is correct
36 Correct 221 ms 85584 KB Output is correct
37 Correct 155 ms 60496 KB Output is correct
38 Correct 87 ms 39760 KB Output is correct
39 Correct 215 ms 85844 KB Output is correct
40 Correct 220 ms 85844 KB Output is correct
41 Correct 169 ms 87644 KB Output is correct
42 Correct 147 ms 76952 KB Output is correct
43 Correct 148 ms 71248 KB Output is correct
44 Correct 188 ms 87544 KB Output is correct
45 Correct 196 ms 87376 KB Output is correct
46 Execution timed out 1577 ms 9444 KB Time limit exceeded
47 Halted 0 ms 0 KB -