#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;
}
# | 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... |