답안 #587813

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
587813 2022-07-02T11:48:11 Z SeDunion Team Contest (JOI22_team) C++17
0 / 100
2000 ms 340 KB
#include<iostream>
#include<algorithm>

using namespace std;

const int N = 1e6 + 123;

using pii = pair<int,int>;

pii x[N], y[N], z[N];
int ix[N], iy[N], iz[N];

int main() {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	int n;
	cin >> n;
	for (int i = 0 ; i < n ; ++ i) {
		cin >> ix[i] >> iy[i] >> iz[i];
		x[i] = {ix[i], i};
		y[i] = {iy[i], i};
		z[i] = {iz[i], i};
	}
	sort(x, x + n);
	sort(y, y + n);
	sort(z, z + n);
	int a = n - 1, b = n - 1, c = n - 1;
	while (a >= 0 && b >= 0 && c >= 0) {
		int i = x[a].second, j = y[b].second, k = z[c].second;
		if (iy[i] == iy[j] || iz[i] == iz[k]) --a;
		if (ix[i] == ix[j] || iz[j] == iz[k]) --b;
		if (iy[j] == iy[k] || ix[i] == ix[k]) --c;
		if (ix[i] > ix[j] && ix[i] > ix[k] && iy[j] > iy[i] && iy[j] > iy[k] && 
				iz[k] > iz[i] && iz[k] > iz[j]) {
			cout << ix[i] + iy[j] + iz[k];
			return 0;
		}
	}
	cout << -1;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Execution timed out 2090 ms 340 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Execution timed out 2090 ms 340 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Execution timed out 2074 ms 340 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Execution timed out 2074 ms 340 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Execution timed out 2074 ms 340 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Execution timed out 2074 ms 340 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 0 ms 340 KB Output is correct
5 Execution timed out 2090 ms 340 KB Time limit exceeded
6 Halted 0 ms 0 KB -