# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1244183 | nvujica | Team Contest (JOI22_team) | C++20 | 0 ms | 0 KiB |
#include <bits/stdc++.h>
#define ll long long
#define fi first
#define se second
using namespace std;
const int maxn = 1e5 + 10;
int n;
int x[maxn];
int y[maxn];
int z[maxn];
int main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
cin >> n;
for(int i = 0; i < n; i++){
cin >> x[i] >> y[i] >> z[i];
mp[]
}
int ans = 0;
for(int a = 0; a < n; a++){
for(int b = 0; b < n; b++){
for(int c = 0; c < n; c++){
if(x[a] > x[b] && x[a] > x[c] && y[b] > y[a] && y[b] > y[c] && z[c] > z[a] && z[c] > z[b]) ans = max(ans, x[a] + y[b] + z[c]);
}
}
}
if(ans == 0) ans--;
cout << ans;
return 0;
}