#include <bits/stdc++.h>
using namespace std;
constexpr int BASE = 1<<18;
struct cord{
int x, y, z;
};
cord INPUT[BASE];
int n;
int check(int i, int j, int k){
int ilei = 0;
int ilej = 0;
int ilek = 0;
int x = max({INPUT[i].x, INPUT[j].x, INPUT[k].x});
int y = max({INPUT[i].y, INPUT[j].y, INPUT[k].y});
int z = max({INPUT[i].z, INPUT[j].z, INPUT[k].z});
if(INPUT[i].x == x) ilei++;
if(INPUT[i].y == y) ilei++;
if(INPUT[i].z == z) ilei++;
if(INPUT[j].x == x) ilej++;
if(INPUT[j].y == y) ilej++;
if(INPUT[j].z == z) ilej++;
if(INPUT[k].x == x) ilek++;
if(INPUT[k].y == y) ilek++;
if(INPUT[k].z == z) ilek++;
if(ilei == ilej && ilej == ilek) return x+y+z;
return -1;
}
int solve(){
int res = -1;
for(int i = 1; i <= n; i++){
for(int j = 1; j <= i-1; j++){
for(int k = 1; k <= j-1; k++){
res = max(res, check(i, j, k));
}
}
}
return res;
}
int main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cin >> n;
for(int i = 1; i <= n; i++)
cin >> INPUT[i].x >> INPUT[i].y >> INPUT[i].z;
cout << solve() << "\n";
}
# |
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 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
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 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
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 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |