Submission #711288

#TimeUsernameProblemLanguageResultExecution timeMemory
711288kostia244Team Contest (JOI22_team)C++17
0 / 100
1 ms212 KiB
#include<bits/stdc++.h> #define all(x) begin(x), end(x) using namespace std; using ll = long long; int main() { cin.tie(0)->sync_with_stdio(0); int n; cin >> n; vector<array<int, 3>> a(n); for(auto &[x, y, z] : a) cin >> x >> y >> z; sort(all(a)); a.erase(unique(all(a)), a.end()); n = a.size(); ll ans = -1; for(int i = 0; i < n; i++) {//z ll xmax = -1, upd = -1; for(int j = 0; j < n; j++) if(a[j][2] < a[i][2]) {//y if(xmax >= a[j][0]) { if(xmax > a[j][0] && upd != a[j][1]) { ans = max(ans, a[i][2] + a[j][1] + xmax); } } else xmax = a[j][0], upd = a[j][1]; } xmax = -1, upd = -1; for(int j = n; j--;) if(a[j][2] < a[i][2]) {//y // cout << a[i][0] << " " << a[i][1] << " " << a[i][2] << endl; // cout << a[j][0] << " " << a[j][1] << " " << a[j][2] << endl; // cout << xmax << " " << upd << " " << a[j][0] << " " << a[j][1] << endl; if(xmax >= a[j][0]) { if(xmax > a[j][0] && upd != a[j][1]) { ans = max(ans, a[i][2] + a[j][1] + xmax); } } else xmax = a[j][0], upd = a[j][1]; } } cout << ans << '\n'; }
#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...