#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;
i = x[a].second, j = y[b].second, k = z[c].second;
if (ix[i] == ix[j] || iz[j] == iz[k]) --b;
i = x[a].second, j = y[b].second, k = z[c].second;
if (iy[j] == iy[k] || ix[i] == ix[k]) --c;
i = x[a].second, j = y[b].second, k = z[c].second;
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;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2096 ms |
340 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2096 ms |
340 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2073 ms |
340 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2073 ms |
340 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2073 ms |
340 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2073 ms |
340 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2096 ms |
340 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |