제출 #794992

#제출 시각아이디문제언어결과실행 시간메모리
794992vjudge1Team Contest (JOI22_team)C++17
0 / 100
1 ms212 KiB
#include<bits/stdc++.h> using namespace std; struct person { int x, y, z; }; int main() { ios::sync_with_stdio(0); cin.tie(0), cout.tie(0); int n; cin >> n; vector<person> a(n); for(int i = 0; i < n; i++) { cin >> a[i].x >> a[i].y >> a[i].z; } sort(a.begin(), a.end(), [](person l, person r) {return l.z < r.z;}); int ans = 0; for(int i = 0; i < n; i++) { cout << a[i].x << ' ' << a[i].y << ' ' << a[i].z << '\n'; int Y = 0, l = i + 1; for(int j = i + 1; j < n; j++) { if(a[j].x >= a[i].x || a[j].z == a[i].z) continue; while (a[l].z < a[j].z) { if(a[l].x < a[i].x) Y = max(Y, a[l].y); l++; } if(Y > max(a[i].y, a[j].y)) { ans = max(ans, a[i].x + Y + a[j].z); } } int X = 0, r = i + 1; for(int j = i + 1; j < n; j++) { if(a[j].y >= a[i].y || a[j].z == a[i].z) continue; while (a[r].z < a[j].z) { if(a[r].y < a[i].y) X = max(X, a[r].x); r++; } if(X > max(a[i].x, a[j].x)) { ans = max(ans, a[i].y + X + a[j].z); } } } if(ans == 0) ans = -1; cout << ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...