Submission #583679

#TimeUsernameProblemLanguageResultExecution timeMemory
583679balbitTeam Contest (JOI22_team)C++14
100 / 100
164 ms10264 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long #define f first #define s second #define pii pair<ll, ll> #define SZ(x) (int)(x).size() #define ALL(x) (x).begin(), (x).end() #define pb push_back #define MX(a,b) a = max(a,b) #define MN(a,b) a = min(a,b) #define FOR(i,a,b) for (int i = a; i<b; ++i) #define REP(i,n) FOR(i,0,n) #define REP1(i,n) FOR(i,1,n+1) #ifdef BALBIT #define bug(...) cerr<<"#"<<__LINE__<<"- "<<#__VA_ARGS__<<": ", _do(__VA_ARGS__) template<typename T> void _do(T && x) {cerr<<x<<endl;} template<typename T, typename ...S> void _do(T && x, S && ...y) {cerr<<x<<", "; _do(y...);} #else #define bug(...) #define endl '\n' #endif // BALBIT const int maxn = 1.5e5+5; struct pt{ int x,y,z; void in(){ cin>>x>>y>>z; } }; vector<array<int, 3> > v[3]; signed main(){ ios::sync_with_stdio(0), cin.tie(0); bug(1,2); int n; cin>>n; REP(i,n) { array<int, 3> a; cin>>a[0]>>a[1]>>a[2]; REP(j,3) v[j].pb(a); } REP(j,3) { sort(ALL(v[j]), [&](array<int, 3> x, array<int, 3> y){return x[j] < y[j];}); } ll re = -1; while (SZ(v[0]) && SZ(v[1]) && SZ(v[2])) { bool bad = 0; REP(j,3) { REP(k,3) { if (k !=j) { if (v[j].back()[k] >= v[k].back()[k]) { v[j].pop_back(); bad = 1; goto nope; } } } } nope:; if (!bad) { re = 0; REP(j,3) { re += v[j].back()[j]; } break; } } cout<<re<<endl; }
#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...