Submission #892322

#TimeUsernameProblemLanguageResultExecution timeMemory
892322vjudge1Team Contest (JOI22_team)C++17
100 / 100
83 ms17828 KiB
#include <bits/stdc++.h> using namespace std; #define pb push_back #define ff first #define ss second #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define int long long // the most CHALISHKANCHIK typedef vector<int> vi; typedef pair<int,int> pii; typedef vector<pii> vii; void solve(){ 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 ; } } cout << "-1\n"; } main(){ ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); int test = 1; //~ cin >> test; while(test--){ solve(); } }

Compilation message (stderr)

team.cpp:46:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   46 | main(){
      | ^~~~
#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...