Submission #850352

#TimeUsernameProblemLanguageResultExecution timeMemory
850352niterTeam Contest (JOI22_team)C++17
0 / 100
1 ms600 KiB
#include <bits/stdc++.h> #define loop(i,a,b) for(int i=a;i<b;i++) #define pii pair<int,int> #define pb push_back #define ins insert #define ff first #define ss second #define opa(x) cout << #x << " = " << x << ", "; #define op(x) cout << #x << " = " << x << "\n"; #define ops(x) cout << x; #define entr cout << '\n'; #define spac cout << ' '; #define all(x) (x).begin(), (x).end() #define STL(x) cout << #x << " : "; for(auto &qwe:x) cout << qwe << ' '; cout << endl; #define deb1 cout << "deb1" << endl; #define deb2 cout << "deb2" << endl; #define deb3 cout << "deb3" << endl; #define deb4 cout << "deb4" << endl; #define deb5 cout << "deb5" << endl; using namespace std; typedef long long ll; struct pp{ int x, y, z; void read(){ cin >> x >> y >> z; } string res(){ // cout << x << y << z << "test\n"; return ("[" + to_string(x) + ", " + to_string(y) + ", " + to_string(z) + "]"); } bool operator<(pp A){ return (x == A.x) ? ( (y == A.y) ? (z > A.z) : (y > A.y) ) : (x > A.x); } }; ostream& operator<<(ostream& os, pp A){ // cerr << "test1"; os << A.res(); } bool dp[21][21][21]; void solve2(vector<pp> &v){ int n = v.size(); loop(i,0,n){ int tx = v[i].x, ty = v[i].y, tz = v[i].z; dp[tx][ty][tz] = true; } int ans = -1; loop(x1,1,6) loop(y1,1,6) loop(z1,1,6){ loop(x2,1,x1) loop(y2,y1+1,6) loop(z2,1,6){ loop(x3,1,x1) loop(y3,1,y2) loop(z3,max(z1,z2)+1,6){ if(dp[x1][y1][z1] && dp[x2][y2][z2] && dp[x3][y3][z3]){ ans = max(ans, x1 + y2 + z3); } } } } cout << ans << '\n'; } void solve(){ int n; cin >> n; vector<pp> v(n); bool flag = true; loop(i,0,n){ v[i].read(); if(v[i].x > 5 || v[i].y > 5 || v[i].z > 5){ flag = false; } } loop(i,0,n){ op(v[i].res()); } if(flag){ solve2(v); return; } sort(all(v)); int ans = -1; loop(i,0,n){ loop(j,i+1,n){ loop(k,j+1,n){ if(j == k) continue; pp tmp1 = v[j]; pp tmp2 = v[k]; if(tmp1.y == tmp2.y || tmp1.z == tmp2.z) continue; if(tmp1.y < tmp2.y) swap(tmp1, tmp2); if(v[i].x > v[j].x && v[i].x > v[k].x && tmp1.y > tmp2.y && tmp1.y > v[i].y && tmp2.z > tmp1.z && tmp2.z > v[i].z){ ans = max(ans, v[i].x + tmp1.y + tmp2.z); } } } } cout << ans << '\n'; } int main(){ // ios::sync_with_stdio(false); cin.tie(0); // freopen("test_input.txt", "r", stdin); int t = 1; while(t--){ solve(); } }

Compilation message (stderr)

team.cpp: In function 'std::ostream& operator<<(std::ostream&, pp)':
team.cpp:39:1: warning: no return statement in function returning non-void [-Wreturn-type]
   39 | }
      | ^
#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...