#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
const long long INF = 1e18;
const int N = 1e5 + 1;
signed main(){
int n;
cin >> n;
int x[n],y[n],z[n];
for(int i = 0;i < n;i++){
cin >> x[i] >> y[i] >> z[i];
}
if(n <= 300){
int ans = -1;
for(int i = 0;i < n;i++){
for(int j = 0;j < n;j++){
for(int k = 0;k < n;k++){
if(i != j && i != k && j != k){
if(x[i] > x[j] && x[i] > x[k] && y[j] > y[i] && y[j] > y[k] && z[k] > z[i] && z[k] > z[j]){
ans = max(ans,x[i] + y[j] + z[k]);
}
}
}
}
}
cout << ans;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 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 |
348 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 |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
64 ms |
412 KB |
Output is correct |
15 |
Correct |
27 ms |
600 KB |
Output is correct |
16 |
Correct |
41 ms |
348 KB |
Output is correct |
17 |
Correct |
51 ms |
408 KB |
Output is correct |
18 |
Correct |
51 ms |
348 KB |
Output is correct |
19 |
Correct |
61 ms |
344 KB |
Output is correct |
20 |
Correct |
49 ms |
344 KB |
Output is correct |
21 |
Correct |
37 ms |
436 KB |
Output is correct |
22 |
Correct |
39 ms |
600 KB |
Output is correct |
23 |
Correct |
36 ms |
408 KB |
Output is correct |
24 |
Correct |
39 ms |
348 KB |
Output is correct |
25 |
Correct |
43 ms |
432 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 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 |
348 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 |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
64 ms |
412 KB |
Output is correct |
15 |
Correct |
27 ms |
600 KB |
Output is correct |
16 |
Correct |
41 ms |
348 KB |
Output is correct |
17 |
Correct |
51 ms |
408 KB |
Output is correct |
18 |
Correct |
51 ms |
348 KB |
Output is correct |
19 |
Correct |
61 ms |
344 KB |
Output is correct |
20 |
Correct |
49 ms |
344 KB |
Output is correct |
21 |
Correct |
37 ms |
436 KB |
Output is correct |
22 |
Correct |
39 ms |
600 KB |
Output is correct |
23 |
Correct |
36 ms |
408 KB |
Output is correct |
24 |
Correct |
39 ms |
348 KB |
Output is correct |
25 |
Correct |
43 ms |
432 KB |
Output is correct |
26 |
Incorrect |
3 ms |
348 KB |
Output isn't correct |
27 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
352 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 |
600 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 |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Incorrect |
47 ms |
3932 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
352 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 |
600 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 |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Incorrect |
47 ms |
3932 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
352 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 |
600 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 |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Incorrect |
47 ms |
3932 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
352 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 |
600 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 |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Incorrect |
47 ms |
3932 KB |
Output isn't correct |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 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 |
348 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 |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
64 ms |
412 KB |
Output is correct |
15 |
Correct |
27 ms |
600 KB |
Output is correct |
16 |
Correct |
41 ms |
348 KB |
Output is correct |
17 |
Correct |
51 ms |
408 KB |
Output is correct |
18 |
Correct |
51 ms |
348 KB |
Output is correct |
19 |
Correct |
61 ms |
344 KB |
Output is correct |
20 |
Correct |
49 ms |
344 KB |
Output is correct |
21 |
Correct |
37 ms |
436 KB |
Output is correct |
22 |
Correct |
39 ms |
600 KB |
Output is correct |
23 |
Correct |
36 ms |
408 KB |
Output is correct |
24 |
Correct |
39 ms |
348 KB |
Output is correct |
25 |
Correct |
43 ms |
432 KB |
Output is correct |
26 |
Incorrect |
3 ms |
348 KB |
Output isn't correct |
27 |
Halted |
0 ms |
0 KB |
- |