Submission #850339

#TimeUsernameProblemLanguageResultExecution timeMemory
850339niterTeam Contest (JOI22_team)C++14
8 / 100
2031 ms2896 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 << '\n';
#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(){
        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);
    }
};

void solve(){
    int n; cin >> n;
    vector<pp> v(n);
    loop(i,0,n){
        v[i].read();
    }
//    loop(i,0,n){
//        op(v[i].res());
//    }
    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();
    }
}
#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...