#include<iostream>
#include<vector>
#include<assert.h>
using namespace std;
using ll = long long;
const int N = 2e5 + 123;
ll ix[N], iy[N], iz[N];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
ll ans = 0;
for (int i = 0 ; i < n ; ++ i) {
cin >> ix[i] >> iy[i] >> iz[i];
}
for (int i = 0 ; i < n ; ++ i) {
for (int j = 0 ; j < n ; ++ j) {
for (int k = 0 ; k < n ; ++ k) {
if (ix[i] > max(ix[j], ix[k]) &&
iy[j] > max(iy[i], iy[k]) &&
iz[k] > max(iz[i], iz[j])) {
ans = max(ans, ix[i] + iy[j] + iz[k]);
}
}
}
}
cout << (ans ? ans : -1);
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Correct |
0 ms |
340 KB |
Output is correct |
12 |
Correct |
0 ms |
340 KB |
Output is correct |
13 |
Correct |
0 ms |
340 KB |
Output is correct |
14 |
Correct |
51 ms |
340 KB |
Output is correct |
15 |
Correct |
20 ms |
348 KB |
Output is correct |
16 |
Correct |
32 ms |
340 KB |
Output is correct |
17 |
Correct |
43 ms |
340 KB |
Output is correct |
18 |
Correct |
39 ms |
340 KB |
Output is correct |
19 |
Correct |
48 ms |
340 KB |
Output is correct |
20 |
Correct |
37 ms |
332 KB |
Output is correct |
21 |
Correct |
26 ms |
340 KB |
Output is correct |
22 |
Correct |
32 ms |
340 KB |
Output is correct |
23 |
Correct |
20 ms |
340 KB |
Output is correct |
24 |
Correct |
24 ms |
352 KB |
Output is correct |
25 |
Correct |
25 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Correct |
0 ms |
340 KB |
Output is correct |
12 |
Correct |
0 ms |
340 KB |
Output is correct |
13 |
Correct |
0 ms |
340 KB |
Output is correct |
14 |
Correct |
51 ms |
340 KB |
Output is correct |
15 |
Correct |
20 ms |
348 KB |
Output is correct |
16 |
Correct |
32 ms |
340 KB |
Output is correct |
17 |
Correct |
43 ms |
340 KB |
Output is correct |
18 |
Correct |
39 ms |
340 KB |
Output is correct |
19 |
Correct |
48 ms |
340 KB |
Output is correct |
20 |
Correct |
37 ms |
332 KB |
Output is correct |
21 |
Correct |
26 ms |
340 KB |
Output is correct |
22 |
Correct |
32 ms |
340 KB |
Output is correct |
23 |
Correct |
20 ms |
340 KB |
Output is correct |
24 |
Correct |
24 ms |
352 KB |
Output is correct |
25 |
Correct |
25 ms |
340 KB |
Output is correct |
26 |
Execution timed out |
2083 ms |
340 KB |
Time limit exceeded |
27 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Execution timed out |
2090 ms |
3772 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Execution timed out |
2090 ms |
3772 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Execution timed out |
2090 ms |
3772 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Execution timed out |
2090 ms |
3772 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
340 KB |
Output is correct |
2 |
Correct |
0 ms |
340 KB |
Output is correct |
3 |
Correct |
1 ms |
340 KB |
Output is correct |
4 |
Correct |
0 ms |
340 KB |
Output is correct |
5 |
Correct |
0 ms |
340 KB |
Output is correct |
6 |
Correct |
0 ms |
340 KB |
Output is correct |
7 |
Correct |
0 ms |
340 KB |
Output is correct |
8 |
Correct |
0 ms |
340 KB |
Output is correct |
9 |
Correct |
0 ms |
340 KB |
Output is correct |
10 |
Correct |
0 ms |
340 KB |
Output is correct |
11 |
Correct |
0 ms |
340 KB |
Output is correct |
12 |
Correct |
0 ms |
340 KB |
Output is correct |
13 |
Correct |
0 ms |
340 KB |
Output is correct |
14 |
Correct |
51 ms |
340 KB |
Output is correct |
15 |
Correct |
20 ms |
348 KB |
Output is correct |
16 |
Correct |
32 ms |
340 KB |
Output is correct |
17 |
Correct |
43 ms |
340 KB |
Output is correct |
18 |
Correct |
39 ms |
340 KB |
Output is correct |
19 |
Correct |
48 ms |
340 KB |
Output is correct |
20 |
Correct |
37 ms |
332 KB |
Output is correct |
21 |
Correct |
26 ms |
340 KB |
Output is correct |
22 |
Correct |
32 ms |
340 KB |
Output is correct |
23 |
Correct |
20 ms |
340 KB |
Output is correct |
24 |
Correct |
24 ms |
352 KB |
Output is correct |
25 |
Correct |
25 ms |
340 KB |
Output is correct |
26 |
Execution timed out |
2083 ms |
340 KB |
Time limit exceeded |
27 |
Halted |
0 ms |
0 KB |
- |