#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define int long long
using namespace std;
const int N = 1.5e5 + 5;
int n, L;
struct tp{
int a, b, c;
bool operator< (const tp& o) const{
return a < o.a || a == o.a && b < o.b || a == o.a && b == o.b && c < o.c;
}
};
tp A[N];
int mx[3][N];
vector<tp> teams;
int ans = -1;
void check(int i, int j, int k){
if(A[i].a > A[j].a && A[i].a > A[k].a && A[j].b > A[i].b && A[j].b > A[k].b && A[k].c > A[i].c && A[k].c > A[j].c)
ans = max(ans, A[i].a + A[j].b + A[k].c);
}
int32_t main(){
ios_base::sync_with_stdio(false);
int n;
cin >> n;
for(int i = 0; i < n; i++){
int a, b, c;
cin >> a >> b >> c;
A[i] = {a, b, c};
}
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
for(int k = 0; k < n; k++){
check(i, j, k);
}
}
}
cout << ans << endl;
}
Compilation message
team.cpp: In member function 'bool tp::operator<(const tp&) const':
team.cpp:15:30: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
15 | return a < o.a || a == o.a && b < o.b || a == o.a && b == o.b && c < o.c;
| ~~~~~~~~~^~~~~~~~~~
team.cpp:15:65: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
15 | return a < o.a || a == o.a && b < o.b || a == o.a && b == o.b && c < o.c;
| ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 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 |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
126 ms |
340 KB |
Output is correct |
15 |
Correct |
59 ms |
340 KB |
Output is correct |
16 |
Correct |
86 ms |
340 KB |
Output is correct |
17 |
Correct |
120 ms |
340 KB |
Output is correct |
18 |
Correct |
102 ms |
340 KB |
Output is correct |
19 |
Correct |
122 ms |
340 KB |
Output is correct |
20 |
Correct |
113 ms |
340 KB |
Output is correct |
21 |
Correct |
93 ms |
332 KB |
Output is correct |
22 |
Correct |
103 ms |
320 KB |
Output is correct |
23 |
Correct |
74 ms |
340 KB |
Output is correct |
24 |
Correct |
82 ms |
340 KB |
Output is correct |
25 |
Correct |
77 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 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 |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
126 ms |
340 KB |
Output is correct |
15 |
Correct |
59 ms |
340 KB |
Output is correct |
16 |
Correct |
86 ms |
340 KB |
Output is correct |
17 |
Correct |
120 ms |
340 KB |
Output is correct |
18 |
Correct |
102 ms |
340 KB |
Output is correct |
19 |
Correct |
122 ms |
340 KB |
Output is correct |
20 |
Correct |
113 ms |
340 KB |
Output is correct |
21 |
Correct |
93 ms |
332 KB |
Output is correct |
22 |
Correct |
103 ms |
320 KB |
Output is correct |
23 |
Correct |
74 ms |
340 KB |
Output is correct |
24 |
Correct |
82 ms |
340 KB |
Output is correct |
25 |
Correct |
77 ms |
340 KB |
Output is correct |
26 |
Execution timed out |
2085 ms |
484 KB |
Time limit exceeded |
27 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
0 ms |
324 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Execution timed out |
2084 ms |
4280 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
0 ms |
324 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Execution timed out |
2084 ms |
4280 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
0 ms |
324 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Execution timed out |
2084 ms |
4280 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
0 ms |
324 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Execution timed out |
2084 ms |
4280 KB |
Time limit exceeded |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 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 |
1 ms |
340 KB |
Output is correct |
5 |
Correct |
1 ms |
328 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
0 ms |
212 KB |
Output is correct |
10 |
Correct |
0 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
126 ms |
340 KB |
Output is correct |
15 |
Correct |
59 ms |
340 KB |
Output is correct |
16 |
Correct |
86 ms |
340 KB |
Output is correct |
17 |
Correct |
120 ms |
340 KB |
Output is correct |
18 |
Correct |
102 ms |
340 KB |
Output is correct |
19 |
Correct |
122 ms |
340 KB |
Output is correct |
20 |
Correct |
113 ms |
340 KB |
Output is correct |
21 |
Correct |
93 ms |
332 KB |
Output is correct |
22 |
Correct |
103 ms |
320 KB |
Output is correct |
23 |
Correct |
74 ms |
340 KB |
Output is correct |
24 |
Correct |
82 ms |
340 KB |
Output is correct |
25 |
Correct |
77 ms |
340 KB |
Output is correct |
26 |
Execution timed out |
2085 ms |
484 KB |
Time limit exceeded |
27 |
Halted |
0 ms |
0 KB |
- |