#include<bits/stdc++.h>
using namespace std;
#define int long long
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define rz resize
#define pb emplace_back
int INF=1e18;
int mod=1e9+7;
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
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||j==k||i==k){
continue;
}
if(a[i]<=a[j]||a[i]<=a[k]||b[j]<=b[i]||b[j]<=b[k]||c[k]<=c[i]||c[k]<=c[j]){
continue;
}
ans=max(ans,a[i]+b[j]+c[k]);
}
}
}
cout<<ans<<endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
1 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 |
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 |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
320 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
86 ms |
324 KB |
Output is correct |
15 |
Correct |
41 ms |
212 KB |
Output is correct |
16 |
Correct |
54 ms |
312 KB |
Output is correct |
17 |
Correct |
71 ms |
212 KB |
Output is correct |
18 |
Correct |
69 ms |
312 KB |
Output is correct |
19 |
Correct |
81 ms |
324 KB |
Output is correct |
20 |
Correct |
68 ms |
312 KB |
Output is correct |
21 |
Correct |
52 ms |
320 KB |
Output is correct |
22 |
Correct |
66 ms |
340 KB |
Output is correct |
23 |
Correct |
48 ms |
212 KB |
Output is correct |
24 |
Correct |
50 ms |
312 KB |
Output is correct |
25 |
Correct |
56 ms |
316 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
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 |
1 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 |
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 |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
320 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
86 ms |
324 KB |
Output is correct |
15 |
Correct |
41 ms |
212 KB |
Output is correct |
16 |
Correct |
54 ms |
312 KB |
Output is correct |
17 |
Correct |
71 ms |
212 KB |
Output is correct |
18 |
Correct |
69 ms |
312 KB |
Output is correct |
19 |
Correct |
81 ms |
324 KB |
Output is correct |
20 |
Correct |
68 ms |
312 KB |
Output is correct |
21 |
Correct |
52 ms |
320 KB |
Output is correct |
22 |
Correct |
66 ms |
340 KB |
Output is correct |
23 |
Correct |
48 ms |
212 KB |
Output is correct |
24 |
Correct |
50 ms |
312 KB |
Output is correct |
25 |
Correct |
56 ms |
316 KB |
Output is correct |
26 |
Execution timed out |
2054 ms |
468 KB |
Time limit exceeded |
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 |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 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 |
1 ms |
316 KB |
Output is correct |
11 |
Execution timed out |
2063 ms |
4688 KB |
Time limit exceeded |
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 |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 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 |
1 ms |
316 KB |
Output is correct |
11 |
Execution timed out |
2063 ms |
4688 KB |
Time limit exceeded |
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 |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 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 |
1 ms |
316 KB |
Output is correct |
11 |
Execution timed out |
2063 ms |
4688 KB |
Time limit exceeded |
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 |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 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 |
1 ms |
316 KB |
Output is correct |
11 |
Execution timed out |
2063 ms |
4688 KB |
Time limit exceeded |
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 |
1 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 |
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 |
0 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
320 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
86 ms |
324 KB |
Output is correct |
15 |
Correct |
41 ms |
212 KB |
Output is correct |
16 |
Correct |
54 ms |
312 KB |
Output is correct |
17 |
Correct |
71 ms |
212 KB |
Output is correct |
18 |
Correct |
69 ms |
312 KB |
Output is correct |
19 |
Correct |
81 ms |
324 KB |
Output is correct |
20 |
Correct |
68 ms |
312 KB |
Output is correct |
21 |
Correct |
52 ms |
320 KB |
Output is correct |
22 |
Correct |
66 ms |
340 KB |
Output is correct |
23 |
Correct |
48 ms |
212 KB |
Output is correct |
24 |
Correct |
50 ms |
312 KB |
Output is correct |
25 |
Correct |
56 ms |
316 KB |
Output is correct |
26 |
Execution timed out |
2054 ms |
468 KB |
Time limit exceeded |
27 |
Halted |
0 ms |
0 KB |
- |