#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std ;
const int N = 15e4 ;
int n, ans = -1, x[N + 1], y[N + 1], z[N + 1] ;
vector<pair<int, pair<int, int>>> z_s ;
int func(int i, int j, int q)
{
if(x[i] > x[j] && x[i] > x[q] && y[j] > y[i] && y[j] > y[q] && z[i] < z[q] && z[j] < z[q])
return x[i] + y[j] + z[q] ;
else
return -1 ;
}
signed 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] ;
if(n <= 300)
{
for(int i = 1 ; i <= n ; i++)
for(int j = 1 ; j <= n ; j++)
{
if(i == j)
continue ;
for(int q = 1 ; q <= n ; q++)
{
if(j == q || i == q)
continue ;
ans = max(ans, func(i, j, q)) ;
}
}
cout << ans << '\n' ;
return 0 ;
}
if(n <= 4000)
{
cout << ans << '\n' ;
return 0 ;
}
return 0 ;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
135 ms |
340 KB |
Output is correct |
15 |
Correct |
53 ms |
340 KB |
Output is correct |
16 |
Correct |
82 ms |
340 KB |
Output is correct |
17 |
Correct |
104 ms |
340 KB |
Output is correct |
18 |
Correct |
94 ms |
340 KB |
Output is correct |
19 |
Correct |
140 ms |
340 KB |
Output is correct |
20 |
Correct |
115 ms |
340 KB |
Output is correct |
21 |
Correct |
83 ms |
320 KB |
Output is correct |
22 |
Correct |
84 ms |
340 KB |
Output is correct |
23 |
Correct |
88 ms |
340 KB |
Output is correct |
24 |
Correct |
88 ms |
340 KB |
Output is correct |
25 |
Correct |
106 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
135 ms |
340 KB |
Output is correct |
15 |
Correct |
53 ms |
340 KB |
Output is correct |
16 |
Correct |
82 ms |
340 KB |
Output is correct |
17 |
Correct |
104 ms |
340 KB |
Output is correct |
18 |
Correct |
94 ms |
340 KB |
Output is correct |
19 |
Correct |
140 ms |
340 KB |
Output is correct |
20 |
Correct |
115 ms |
340 KB |
Output is correct |
21 |
Correct |
83 ms |
320 KB |
Output is correct |
22 |
Correct |
84 ms |
340 KB |
Output is correct |
23 |
Correct |
88 ms |
340 KB |
Output is correct |
24 |
Correct |
88 ms |
340 KB |
Output is correct |
25 |
Correct |
106 ms |
340 KB |
Output is correct |
26 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
27 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Incorrect |
17 ms |
2072 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Incorrect |
17 ms |
2072 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Incorrect |
17 ms |
2072 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
1 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Incorrect |
17 ms |
2072 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
0 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
340 KB |
Output is correct |
14 |
Correct |
135 ms |
340 KB |
Output is correct |
15 |
Correct |
53 ms |
340 KB |
Output is correct |
16 |
Correct |
82 ms |
340 KB |
Output is correct |
17 |
Correct |
104 ms |
340 KB |
Output is correct |
18 |
Correct |
94 ms |
340 KB |
Output is correct |
19 |
Correct |
140 ms |
340 KB |
Output is correct |
20 |
Correct |
115 ms |
340 KB |
Output is correct |
21 |
Correct |
83 ms |
320 KB |
Output is correct |
22 |
Correct |
84 ms |
340 KB |
Output is correct |
23 |
Correct |
88 ms |
340 KB |
Output is correct |
24 |
Correct |
88 ms |
340 KB |
Output is correct |
25 |
Correct |
106 ms |
340 KB |
Output is correct |
26 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
27 |
Halted |
0 ms |
0 KB |
- |