Submission #770260

#TimeUsernameProblemLanguageResultExecution timeMemory
770260PlurmTeam Contest (JOI22_team)C++11
0 / 100
2074 ms3464 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; vector<tuple<int, int, int>> pts; for (int i = 0; i < n; i++) { int x, y, z; cin >> x >> y >> z; pts.push_back({x, y, z}); } int mx = -1; sort(pts.begin(), pts.end(), [](tuple<int, int, int> x, tuple<int, int, int> y) { return get<1>(x) < get<1>(y); }); for (int i = 0; i < n; i++) { vector<int> cand; for (int k = 0; k < n; k++) { if (get<0>(pts[k]) < get<0>(pts[i])) cand.push_back(k); } int mxz = -1; for (int k : cand) { if (k < i) { mxz = max(mxz, get<2>(pts[k])); } } for (int j = i + 1; j < n; j++) { if (get<0>(pts[i]) > get<0>(pts[j])) { if (mxz > get<2>(pts[i]) && mxz > get<2>(pts[j])) { mx = max(mx, get<0>(pts[i]) + get<1>(pts[j]) + mxz); } } if (binary_search(cand.begin(), cand.end(), j)) mxz = max(mxz, get<2>(pts[j])); } } cout << mx << endl; return 0; }
#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...