#include <bits/stdc++.h>
using namespace std;
int N;
int X[150006], Y[150006], Z[150006];
int main()
{
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cin >> N;
for(int i = 1; i <= N; i++) cin >> X[i] >> Y[i] >> Z[i];
int x, y, z, sol = 0;
for(int i = 1; i <= N; i++)
{
for(int j = i + 1; j <= N; j++)
{
for(int k = j + 1; k <= N; k++)
{
x = y = z = i;
bool flagx = 0, flagy = 0, flagz = 0;
if(X[j] == X[x]) flagx = 1;
if(X[j] > X[x]) {x = j; flagx = 0;}
if(X[k] == X[x]) flagx = 1;
if(X[k] > X[x]) {x = k; flagx = 0;}
if(Y[j] == Y[y]) flagy = 1;
if(Y[j] > Y[y]) {y = j; flagy = 0;}
if(Y[k] == Y[y]) flagy = 1;
if(Y[k] > Y[y]) {y = k; flagy = 0;}
if(Z[j] == Z[z]) flagz = 1;
if(Z[j] > Z[z]) {z = j; flagz = 0;}
if(Z[k] == Z[z]) flagz = 1;
if(Z[k] > Z[z]) {z = k; flagz = 0;}
if(flagx || flagy || flagz) continue;
if((x != y) && (x != z) && (y != z)) sol = max(X[x] + Y[y] + Z[z], sol);
}
}
}
cout << sol << '\n';
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... |