답안 #887597

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
887597 2023-12-14T20:02:11 Z MinaRagy06 Team Contest (JOI22_team) C++17
27 / 100
107 ms 2404 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
 
const int inf = 1e9;
int mn[305], mx[305];
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	int n;
	cin >> n;
	array<int, 3> a[n];
	for (int i = 0; i < n; i++) {
		cin >> a[i][0] >> a[i][1] >> a[i][2];
	}
	sort(a, a + n);
	int ans = -1;
	int cur = 0;
	for (int i = 0; i < 305; i++) {
		mn[i] = inf;
		mx[i] = -inf;
	}
	int y = -1;
	for (int i = 0; i < n; i++) {
		while (a[cur][0] < a[i][0]) {
			mx[a[cur][1]] = max(mx[a[cur][1]], a[cur][2]);
			mn[a[cur][1]] = min(mn[a[cur][1]], a[cur][2]);
			for (int newy = 304; newy > a[cur][1]; newy--) {
				if (mn[newy] < a[cur][2]) {
					y = max(y, newy);
					break;
				}
			}
			for (int newy = 0; newy < a[cur][1]; newy++) {
				if (mx[newy] > a[cur][2]) {
					y = max(y, a[cur][1]);
					break;
				}
			}
			cur++;
		}
		int sufxmx[305]{};
		sufxmx[0] = mx[0];
		for (int j = 1; j < 305; j++) {
			sufxmx[j] = max(sufxmx[j - 1], mx[j]);
		}
		if (y >= max(1, a[i][1] + 1)) {
			if (a[i][2] < sufxmx[y - 1]) {
				ans = max(ans, a[i][0] + sufxmx[y - 1] + y);
			}
		}
	}
	cout << ans << '\n';
	return 0;
}
 
 
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 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 Runtime error 1 ms 604 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 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 Runtime error 1 ms 604 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 94 ms 2140 KB Output is correct
12 Correct 62 ms 1604 KB Output is correct
13 Correct 75 ms 1880 KB Output is correct
14 Correct 90 ms 2136 KB Output is correct
15 Correct 86 ms 2216 KB Output is correct
16 Correct 75 ms 2140 KB Output is correct
# 결과 실행 시간 메모리 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 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 94 ms 2140 KB Output is correct
12 Correct 62 ms 1604 KB Output is correct
13 Correct 75 ms 1880 KB Output is correct
14 Correct 90 ms 2136 KB Output is correct
15 Correct 86 ms 2216 KB Output is correct
16 Correct 75 ms 2140 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 2 ms 348 KB Output is correct
22 Correct 107 ms 2140 KB Output is correct
23 Correct 97 ms 2404 KB Output is correct
24 Correct 72 ms 1628 KB Output is correct
25 Correct 105 ms 2196 KB Output is correct
26 Correct 82 ms 2136 KB Output is correct
# 결과 실행 시간 메모리 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 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 94 ms 2140 KB Output is correct
12 Correct 62 ms 1604 KB Output is correct
13 Correct 75 ms 1880 KB Output is correct
14 Correct 90 ms 2136 KB Output is correct
15 Correct 86 ms 2216 KB Output is correct
16 Correct 75 ms 2140 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 2 ms 348 KB Output is correct
22 Correct 107 ms 2140 KB Output is correct
23 Correct 97 ms 2404 KB Output is correct
24 Correct 72 ms 1628 KB Output is correct
25 Correct 105 ms 2196 KB Output is correct
26 Correct 82 ms 2136 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 3 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 91 ms 2124 KB Output is correct
35 Correct 90 ms 1884 KB Output is correct
36 Correct 99 ms 2140 KB Output is correct
37 Correct 98 ms 2136 KB Output is correct
38 Correct 84 ms 2136 KB Output is correct
39 Correct 46 ms 1368 KB Output is correct
# 결과 실행 시간 메모리 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 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 94 ms 2140 KB Output is correct
12 Correct 62 ms 1604 KB Output is correct
13 Correct 75 ms 1880 KB Output is correct
14 Correct 90 ms 2136 KB Output is correct
15 Correct 86 ms 2216 KB Output is correct
16 Correct 75 ms 2140 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 2 ms 348 KB Output is correct
22 Correct 107 ms 2140 KB Output is correct
23 Correct 97 ms 2404 KB Output is correct
24 Correct 72 ms 1628 KB Output is correct
25 Correct 105 ms 2196 KB Output is correct
26 Correct 82 ms 2136 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 0 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 3 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 348 KB Output is correct
34 Correct 91 ms 2124 KB Output is correct
35 Correct 90 ms 1884 KB Output is correct
36 Correct 99 ms 2140 KB Output is correct
37 Correct 98 ms 2136 KB Output is correct
38 Correct 84 ms 2136 KB Output is correct
39 Correct 46 ms 1368 KB Output is correct
40 Runtime error 1 ms 604 KB Execution killed with signal 11
41 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 344 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 Runtime error 1 ms 604 KB Execution killed with signal 11
15 Halted 0 ms 0 KB -