#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
using namespace std;
const int maxn = 1.5e5 + 10;
int n;
//int x[maxn];
//int y[maxn];
//int z[maxn];
map <vector <int>, int> mp;
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> n;
for(int i = 0; i < n; i++){
int x, y, z;
cin >> x >> y >> z;
mp[{x, y, z}] = 1;
}
int ans = 0;
for(int xa = 1; xa <= 5; xa++){
for(int yb = 1; yb <= 5; yb++){
for(int zc = 1; zc <= 5; zc++){
for(int xc = 1; xc < xa; xc++){
for(int ya = 1; ya < yb; ya++){
for(int zb = 1; zb < zc; zb++){
for(int xb = 1; xb < xa; xb++){
for(int yc = 1; yc < yb; yc++){
for(int za = 1; za < zc; za++){
if(mp[{xa, ya, za}] && mp[{xb, yb, zb}] && mp[{xc, yc, zc}]) ans = max(ans, xa + yb + zc);
}
}
}
}
}
}
}
}
}
if(ans == 0) ans--;
cout << ans;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |