Submission #943541

#TimeUsernameProblemLanguageResultExecution timeMemory
943541alextodoranTeam Contest (JOI22_team)C++17
0 / 100
123 ms17744 KiB
/** _ _ __ _ _ _ _ _ _ |a ||t ||o d | |o | | __ _| | _ | __| _ | | __ |/_ | __ /__\ / _\| **/ #include <bits/stdc++.h> using namespace std; typedef long long ll; const int N_MAX = 150000; int N; int X[N_MAX + 2], Y[N_MAX + 2], Z[N_MAX + 2]; int order[N_MAX + 2]; set <pair <int, int>> sy, sz; int main () { ios_base::sync_with_stdio(false); cin.tie(0); cin >> N; for (int i = 1; i <= N; i++) { cin >> X[i] >> Y[i] >> Z[i]; } iota(order + 1, order + N + 1, 1); sort(order + 1, order + N + 1, [&] (const int &i, const int &j) { return X[i] < X[j]; }); for (int i = 1; i <= N; i++) { sy.insert(make_pair(-Y[i], i)); sz.insert(make_pair(-Z[i], i)); } int answer = -1; for (int _ = N; _ >= 1; _--) { int i = order[_]; sy.erase(make_pair(-Y[i], i)); sz.erase(make_pair(-Z[i], i)); while (sy.empty() == false && sy.begin()->second == sz.begin()->second) { sy.erase(sy.begin()); sz.erase(sz.begin()); } if (sy.empty() == true) { break; } int j = sy.begin()->second; int k = sz.begin()->second; if (X[i] > max(X[j], X[k]) && Y[j] > max(Y[i], Y[k]) && Z[k] > max(Z[i], Z[j])) { answer = max(answer, X[i] + Y[j] + Z[k]); } } cout << answer << "\n"; 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...