//君の手を握ってしまったら
//孤独を知らないこの街には
//もう二度と帰ってくることはできないのでしょう
//君が手を差し伸べた 光で影が生まれる
//歌って聞かせて この話の続き
//連れて行って見たことない星まで
//さユリ - 花の塔
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int ll
#define starburst ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
#define pii pair<int,int>
#define pb push_back
#define ff first
#define ss second
#define N 100005
struct bev{
int t, x, y, z;
};
void solve(){
int n; cin >> n;
vector<bev> v(n), buk[3];
for(int i = 0; i < n; ++i){
cin >> v[i].x >> v[i].y >> v[i].z; v[i].t = i;
int k = max({v[i].x, v[i].y, v[i].z});
if(k == v[i].x) buk[0].pb(v[i]);
if(k == v[i].y) buk[1].pb(v[i]);
if(k == v[i].z) buk[2].pb(v[i]);
}
sort(buk[0].begin(), buk[0].end(), [](bev a, bev b){return a.x > b.x;});
sort(buk[1].begin(), buk[1].end(), [](bev a, bev b){return a.y > b.y;});
sort(buk[2].begin(), buk[2].end(), [](bev a, bev b){return a.z > b.z;});
int ans = -1;
for(int i = 0; i < n; ++i){
for(int j = 0; j < n; ++j){
bev b1 = v[i], b2 = v[j];
if(b1.t == b2.t) continue;
if(b1.x <= b2.x || b2.y <= b1.y) break;
for(int k = 0; k < n; ++k){
bev b3 = v[k];
if(b1.t == b3.t || b2.t == b3.t) continue;
if(b1.x <= b3.x || b2.y <= b3.y) continue;
if(b3.z <= max(b2.z, b1.z)) break;
ans = max(ans, b1.x + b2.y + b3.z);
}
}
}
cout << ans << '\n';
}
signed main(){
starburst
int t = 1; //cin >> t;
while(t--) solve();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |