#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
#define int long long
#define pb push_back
#define ff first
#define ss second
#define all(v) v.begin(), v.end()
#define rall(v) v.rbegin(), v.rend()
#define ordered_set tree<ll, null_type, less<ll>, rb_tree_tag, tree_order_statistics_node_update>
#define ordered_multiset tree<type1, null_type, less_equal<type1>, rb_tree_tag, tree_order_statistics_node_update>;
using namespace std;
using namespace __gnu_pbds;
const int mod = 998244353;
const double PI = acos(-1.0);
const double epsilon = 1e-6;
const int N = 2e5+5;
void solve(){
int n; cin >> n;
vector<int> a(n),b(n),c(n);
for(int i = 0; i < n; i++){
cin >> a[i] >> b[i] >> c[i];
}
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) continue;
if(a[i] > a[j] && a[i] > a[k] &&
b[j] > b[i] && b[j] > b[k] &&
c[k] > c[j] && c[k] > c[i]
) ans = max(ans, a[i] + b[j] + c[k]);
}
}
}
cout << ans;
}
main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int tt = 1;
//cin >> tt;
while (tt--) {
solve();
}
}
Compilation message
team.cpp:44:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
44 | main(){
| ^~~~
# |
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 |
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 |
71 ms |
348 KB |
Output is correct |
15 |
Correct |
30 ms |
348 KB |
Output is correct |
16 |
Correct |
48 ms |
348 KB |
Output is correct |
17 |
Correct |
55 ms |
344 KB |
Output is correct |
18 |
Correct |
52 ms |
344 KB |
Output is correct |
19 |
Correct |
72 ms |
344 KB |
Output is correct |
20 |
Correct |
58 ms |
592 KB |
Output is correct |
21 |
Correct |
38 ms |
348 KB |
Output is correct |
22 |
Correct |
41 ms |
348 KB |
Output is correct |
23 |
Correct |
36 ms |
348 KB |
Output is correct |
24 |
Correct |
38 ms |
444 KB |
Output is correct |
25 |
Correct |
38 ms |
348 KB |
Output is correct |
# |
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 |
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 |
71 ms |
348 KB |
Output is correct |
15 |
Correct |
30 ms |
348 KB |
Output is correct |
16 |
Correct |
48 ms |
348 KB |
Output is correct |
17 |
Correct |
55 ms |
344 KB |
Output is correct |
18 |
Correct |
52 ms |
344 KB |
Output is correct |
19 |
Correct |
72 ms |
344 KB |
Output is correct |
20 |
Correct |
58 ms |
592 KB |
Output is correct |
21 |
Correct |
38 ms |
348 KB |
Output is correct |
22 |
Correct |
41 ms |
348 KB |
Output is correct |
23 |
Correct |
36 ms |
348 KB |
Output is correct |
24 |
Correct |
38 ms |
444 KB |
Output is correct |
25 |
Correct |
38 ms |
348 KB |
Output is correct |
26 |
Execution timed out |
2047 ms |
604 KB |
Time limit exceeded |
27 |
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 |
Execution timed out |
2072 ms |
3932 KB |
Time limit exceeded |
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 |
Execution timed out |
2072 ms |
3932 KB |
Time limit exceeded |
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 |
Execution timed out |
2072 ms |
3932 KB |
Time limit exceeded |
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 |
Execution timed out |
2072 ms |
3932 KB |
Time limit exceeded |
12 |
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 |
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 |
71 ms |
348 KB |
Output is correct |
15 |
Correct |
30 ms |
348 KB |
Output is correct |
16 |
Correct |
48 ms |
348 KB |
Output is correct |
17 |
Correct |
55 ms |
344 KB |
Output is correct |
18 |
Correct |
52 ms |
344 KB |
Output is correct |
19 |
Correct |
72 ms |
344 KB |
Output is correct |
20 |
Correct |
58 ms |
592 KB |
Output is correct |
21 |
Correct |
38 ms |
348 KB |
Output is correct |
22 |
Correct |
41 ms |
348 KB |
Output is correct |
23 |
Correct |
36 ms |
348 KB |
Output is correct |
24 |
Correct |
38 ms |
444 KB |
Output is correct |
25 |
Correct |
38 ms |
348 KB |
Output is correct |
26 |
Execution timed out |
2047 ms |
604 KB |
Time limit exceeded |
27 |
Halted |
0 ms |
0 KB |
- |