#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 = 2e5+5;
const int MxC = 25;
bool cc[MxC][MxC][MxC], cc2[MxC][MxC];
struct Point {
ll x, y, z;
Point() {}
Point(ll xx, ll yy, ll zz) : x(xx), y(yy), z(zz) {}
} p[N];
vector<Point> v[MxC];
inline bool cmp_x(Point a, Point b) { return a.x < b.x; }
int main(void)
{ IO
ll n, i, j, tmp, ans=-1, k;
cin >> n;
for (i=1; i <= n; ++i)
cin >> p[i].x >> p[i].y >> p[i].z, cc[p[i].x][p[i].y][p[i].z] = 1;
n = 0;
for (i=1; i < MxC; ++i)
{
for (j=1; j < MxC; ++j)
{
for (k=1; k < MxC; ++k)
{
if (cc[i][j][k])
{
++n;
p[n] = {i, j, k}, v[i].pb(p[n]);
}
}
}
}
sort(p+1, p+n+1, cmp_x);
for (i=1; i <= 20; ++i)
{
for (auto cur : v[i])
{
//debug(cur.x), debug(cur.y), debug(cur.z), endl;
for (j=cur.y+1; j < MxC; ++j)
for (k=cur.z+1; k < MxC; ++k) if (cc2[j][k]) ans = max(ans, i+j+k);
}
for (auto cur : v[i])
{
for (j=1; j <= n; ++j)
{
if (p[j].x > i) break;
if ((p[j].y > cur.y && p[j].z < cur.z)
|| (p[j].y < cur.y && p[j].z > cur.z))
cc2[max(p[j].y, cur.y)][max(p[j].z, cur.z)] = 1;
}
}
}
/*for (i=1; i < MxC; ++i)
for (j=1; j < MxC; ++j) if (cc2[i][j]) debug(i), debug(j), endl;*/
cout << ans << '\n';
return 0;
}
Compilation message
team.cpp: In function 'int main()':
team.cpp:30:17: warning: unused variable 'tmp' [-Wunused-variable]
30 | ll n, i, j, tmp, ans=-1, k;
| ^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
15 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
600 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
17 ms |
4752 KB |
Output is correct |
12 |
Correct |
11 ms |
4700 KB |
Output is correct |
13 |
Correct |
14 ms |
4748 KB |
Output is correct |
14 |
Correct |
21 ms |
4696 KB |
Output is correct |
15 |
Correct |
17 ms |
4700 KB |
Output is correct |
16 |
Correct |
22 ms |
4904 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
600 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
17 ms |
4752 KB |
Output is correct |
12 |
Correct |
11 ms |
4700 KB |
Output is correct |
13 |
Correct |
14 ms |
4748 KB |
Output is correct |
14 |
Correct |
21 ms |
4696 KB |
Output is correct |
15 |
Correct |
17 ms |
4700 KB |
Output is correct |
16 |
Correct |
22 ms |
4904 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
7 ms |
348 KB |
Output is correct |
22 |
Correct |
86 ms |
6108 KB |
Output is correct |
23 |
Correct |
20 ms |
5724 KB |
Output is correct |
24 |
Correct |
19 ms |
5576 KB |
Output is correct |
25 |
Correct |
21 ms |
5724 KB |
Output is correct |
26 |
Correct |
18 ms |
5724 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
600 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
17 ms |
4752 KB |
Output is correct |
12 |
Correct |
11 ms |
4700 KB |
Output is correct |
13 |
Correct |
14 ms |
4748 KB |
Output is correct |
14 |
Correct |
21 ms |
4696 KB |
Output is correct |
15 |
Correct |
17 ms |
4700 KB |
Output is correct |
16 |
Correct |
22 ms |
4904 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
7 ms |
348 KB |
Output is correct |
22 |
Correct |
86 ms |
6108 KB |
Output is correct |
23 |
Correct |
20 ms |
5724 KB |
Output is correct |
24 |
Correct |
19 ms |
5576 KB |
Output is correct |
25 |
Correct |
21 ms |
5724 KB |
Output is correct |
26 |
Correct |
18 ms |
5724 KB |
Output is correct |
27 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 11 |
28 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
4 |
Correct |
0 ms |
344 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
1 ms |
600 KB |
Output is correct |
7 |
Correct |
1 ms |
344 KB |
Output is correct |
8 |
Correct |
0 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
344 KB |
Output is correct |
11 |
Correct |
17 ms |
4752 KB |
Output is correct |
12 |
Correct |
11 ms |
4700 KB |
Output is correct |
13 |
Correct |
14 ms |
4748 KB |
Output is correct |
14 |
Correct |
21 ms |
4696 KB |
Output is correct |
15 |
Correct |
17 ms |
4700 KB |
Output is correct |
16 |
Correct |
22 ms |
4904 KB |
Output is correct |
17 |
Correct |
0 ms |
348 KB |
Output is correct |
18 |
Correct |
0 ms |
348 KB |
Output is correct |
19 |
Correct |
0 ms |
348 KB |
Output is correct |
20 |
Correct |
0 ms |
348 KB |
Output is correct |
21 |
Correct |
7 ms |
348 KB |
Output is correct |
22 |
Correct |
86 ms |
6108 KB |
Output is correct |
23 |
Correct |
20 ms |
5724 KB |
Output is correct |
24 |
Correct |
19 ms |
5576 KB |
Output is correct |
25 |
Correct |
21 ms |
5724 KB |
Output is correct |
26 |
Correct |
18 ms |
5724 KB |
Output is correct |
27 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 11 |
28 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
0 ms |
348 KB |
Output is correct |
8 |
Correct |
0 ms |
344 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
1 ms |
344 KB |
Output is correct |
14 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
15 |
Halted |
0 ms |
0 KB |
- |