#include <bits/stdc++.h>
#define IO ios::sync_with_stdio(false);cin.tie(0);
#define debug(x) cerr << #x << " = " << (x) << ' '
#define endl cerr << '\n'
#define all(v) (v).begin(), (v).end()
#define SZ(v) (ll)(v).size()
#define lowbit(x) (x)&-(x)
#define pb emplace_back
#define F first
#define S second
using namespace std;
using ll = long long;
using pll = pair<ll, ll>;
const int N = 1e5+5;
ll x[N], y[N], z[N], c[N];
vector<int> v;
inline bool cmp_x(int a, int b) { return x[a] > x[b]; }
inline bool cmp_y(int a, int b) { return y[a] > y[b]; }
inline bool cmp_z(int a, int b) { return z[a] > z[b]; }
int main(void)
{ IO
ll n, i, j, k, tmp, mx=-1;
cin >> n;
for (i=1; i <= n; ++i) cin >> x[i] >> y[i] >> z[i];
for (i=1; i <= n; ++i)
{
for (j=1; j <= n; ++j)
{
if (i == j) continue;
for (k=1; k <= n; ++k)
{
if (i == k || j == k) continue;
v.clear();
v.pb(i), v.pb(j), v.pb(k), c[i] = c[j] = c[k] = 0;
tmp = 0;
sort(all(v), cmp_x);
c[v[0]] = (x[v[0]] != x[v[1]]), tmp += x[v[0]];
sort(all(v), cmp_y);
c[v[0]] = (y[v[0]] != y[v[1]]), tmp += y[v[0]];
sort(all(v), cmp_z);
c[v[0]] = (z[v[0]] != z[v[1]]), tmp += z[v[0]];
if (c[i] + c[j] + c[k] == 3) mx = max(mx, tmp);
}
}
}
cout << mx << '\n';
return 0;
}
/*
5
3 1 4
2 3 1
1 5 5
4 4 2
5 2 3
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
0 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2520 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2396 KB |
Output is correct |
7 |
Correct |
0 ms |
2396 KB |
Output is correct |
8 |
Correct |
2 ms |
2396 KB |
Output is correct |
9 |
Correct |
1 ms |
2396 KB |
Output is correct |
10 |
Correct |
0 ms |
2396 KB |
Output is correct |
11 |
Correct |
0 ms |
2396 KB |
Output is correct |
12 |
Correct |
1 ms |
2396 KB |
Output is correct |
13 |
Correct |
1 ms |
2396 KB |
Output is correct |
14 |
Correct |
1915 ms |
2504 KB |
Output is correct |
15 |
Correct |
848 ms |
2504 KB |
Output is correct |
16 |
Correct |
1300 ms |
2508 KB |
Output is correct |
17 |
Correct |
1687 ms |
2504 KB |
Output is correct |
18 |
Correct |
1516 ms |
2504 KB |
Output is correct |
19 |
Correct |
1870 ms |
2508 KB |
Output is correct |
20 |
Correct |
1745 ms |
2500 KB |
Output is correct |
21 |
Correct |
1463 ms |
2644 KB |
Output is correct |
22 |
Correct |
1261 ms |
2644 KB |
Output is correct |
23 |
Correct |
1252 ms |
2644 KB |
Output is correct |
24 |
Correct |
1306 ms |
2508 KB |
Output is correct |
25 |
Correct |
1313 ms |
2500 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
0 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2520 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2396 KB |
Output is correct |
7 |
Correct |
0 ms |
2396 KB |
Output is correct |
8 |
Correct |
2 ms |
2396 KB |
Output is correct |
9 |
Correct |
1 ms |
2396 KB |
Output is correct |
10 |
Correct |
0 ms |
2396 KB |
Output is correct |
11 |
Correct |
0 ms |
2396 KB |
Output is correct |
12 |
Correct |
1 ms |
2396 KB |
Output is correct |
13 |
Correct |
1 ms |
2396 KB |
Output is correct |
14 |
Correct |
1915 ms |
2504 KB |
Output is correct |
15 |
Correct |
848 ms |
2504 KB |
Output is correct |
16 |
Correct |
1300 ms |
2508 KB |
Output is correct |
17 |
Correct |
1687 ms |
2504 KB |
Output is correct |
18 |
Correct |
1516 ms |
2504 KB |
Output is correct |
19 |
Correct |
1870 ms |
2508 KB |
Output is correct |
20 |
Correct |
1745 ms |
2500 KB |
Output is correct |
21 |
Correct |
1463 ms |
2644 KB |
Output is correct |
22 |
Correct |
1261 ms |
2644 KB |
Output is correct |
23 |
Correct |
1252 ms |
2644 KB |
Output is correct |
24 |
Correct |
1306 ms |
2508 KB |
Output is correct |
25 |
Correct |
1313 ms |
2500 KB |
Output is correct |
26 |
Execution timed out |
2051 ms |
2652 KB |
Time limit exceeded |
27 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
0 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2516 KB |
Output is correct |
7 |
Correct |
1 ms |
2396 KB |
Output is correct |
8 |
Correct |
1 ms |
2512 KB |
Output is correct |
9 |
Correct |
0 ms |
2512 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Runtime error |
14 ms |
7140 KB |
Execution killed with signal 11 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
0 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2516 KB |
Output is correct |
7 |
Correct |
1 ms |
2396 KB |
Output is correct |
8 |
Correct |
1 ms |
2512 KB |
Output is correct |
9 |
Correct |
0 ms |
2512 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Runtime error |
14 ms |
7140 KB |
Execution killed with signal 11 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
0 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2516 KB |
Output is correct |
7 |
Correct |
1 ms |
2396 KB |
Output is correct |
8 |
Correct |
1 ms |
2512 KB |
Output is correct |
9 |
Correct |
0 ms |
2512 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Runtime error |
14 ms |
7140 KB |
Execution killed with signal 11 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
0 ms |
2396 KB |
Output is correct |
3 |
Correct |
1 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2396 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2516 KB |
Output is correct |
7 |
Correct |
1 ms |
2396 KB |
Output is correct |
8 |
Correct |
1 ms |
2512 KB |
Output is correct |
9 |
Correct |
0 ms |
2512 KB |
Output is correct |
10 |
Correct |
1 ms |
2396 KB |
Output is correct |
11 |
Runtime error |
14 ms |
7140 KB |
Execution killed with signal 11 |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2396 KB |
Output is correct |
2 |
Correct |
1 ms |
2396 KB |
Output is correct |
3 |
Correct |
0 ms |
2396 KB |
Output is correct |
4 |
Correct |
1 ms |
2520 KB |
Output is correct |
5 |
Correct |
1 ms |
2396 KB |
Output is correct |
6 |
Correct |
1 ms |
2396 KB |
Output is correct |
7 |
Correct |
0 ms |
2396 KB |
Output is correct |
8 |
Correct |
2 ms |
2396 KB |
Output is correct |
9 |
Correct |
1 ms |
2396 KB |
Output is correct |
10 |
Correct |
0 ms |
2396 KB |
Output is correct |
11 |
Correct |
0 ms |
2396 KB |
Output is correct |
12 |
Correct |
1 ms |
2396 KB |
Output is correct |
13 |
Correct |
1 ms |
2396 KB |
Output is correct |
14 |
Correct |
1915 ms |
2504 KB |
Output is correct |
15 |
Correct |
848 ms |
2504 KB |
Output is correct |
16 |
Correct |
1300 ms |
2508 KB |
Output is correct |
17 |
Correct |
1687 ms |
2504 KB |
Output is correct |
18 |
Correct |
1516 ms |
2504 KB |
Output is correct |
19 |
Correct |
1870 ms |
2508 KB |
Output is correct |
20 |
Correct |
1745 ms |
2500 KB |
Output is correct |
21 |
Correct |
1463 ms |
2644 KB |
Output is correct |
22 |
Correct |
1261 ms |
2644 KB |
Output is correct |
23 |
Correct |
1252 ms |
2644 KB |
Output is correct |
24 |
Correct |
1306 ms |
2508 KB |
Output is correct |
25 |
Correct |
1313 ms |
2500 KB |
Output is correct |
26 |
Execution timed out |
2051 ms |
2652 KB |
Time limit exceeded |
27 |
Halted |
0 ms |
0 KB |
- |