Submission #943539

#TimeUsernameProblemLanguageResultExecution timeMemory
943539alextodoranTeam Contest (JOI22_team)C++17
0 / 100
1 ms2648 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; } if (X[i] > X[i - 1]) { answer = max(answer, X[i] - sy.begin()->first - sz.begin()->first); } } 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...