Submission #892312

#TimeUsernameProblemLanguageResultExecution timeMemory
892312vjudge1Team Contest (JOI22_team)C++17
100 / 100
163 ms17320 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define pb push_back #define all(x) x.begin(),x.end() #define ff first #define ss second const long long INF = 1e18; const int N = 1e5 + 1; signed main(){ int n; cin >> n; vector<int> x(n),y(n),z(n); vector<pair<int,int>> vx,vy,vz; for(int i = 0;i < n;i++){ cin >> x[i] >> y[i] >> z[i]; vx.pb({x[i],i}); vy.pb({y[i],i}); vz.pb({z[i],i}); } sort(all(vx)); sort(all(vy)); sort(all(vz)); int px = n - 1,py = n - 1,pz = n - 1; while(px >= 0 && py >= 0 && pz >= 0){ auto [nx,p1] = vx[px]; auto [ny,p2] = vy[py]; auto [nz,p3] = vz[pz]; if(y[p1] >= ny || z[p1] >= nz){ px--; } else if(x[p2] >= nx || z[p2] >= nz){ py--; } else if(x[p3] >= nx || y[p3] >= ny){ pz--; } else{ cout << nx + ny + nz << "\n"; return 0; } } cout << "-1\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...