Submission #545279

# Submission time Handle Problem Language Result Execution time Memory
545279 2022-04-04T06:56:35 Z leaked Team Contest (JOI22_team) C++14
8 / 100
2000 ms 9916 KB
#include <bits/stdc++.h>

#define f first
#define s second
#define m_p make_pair
#define all(x) (x).begin(),(x).end()
#define rall(x) (x).rbegin(),(x).rend()
#define vec vector
#define pb push_back
#define sz(x) (int)(x).size()
#define pw(x) (1LL<<(x))
#define fast_resp ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef long double ld;
typedef pair<int,ll> pil;
template<class T> bool umin(T &a,const T &b){return (a>b?a=b,1:0);}
template<class T> bool umax(T &a,const T &b){return (a<b?a=b,1:0);}
const ll inf=1e18;
signed main(){
    fast_resp;
    int n;
    cin>>n;
    vec<vec<int>>a(n,vec<int>(3));
    vec<int>mx(3);
    vec<vec<int>> kekw(3);
    for(int i=0;i<n;i++){
        for(int j=0;j<3;j++){
            cin>>a[i][j],umax(mx[j],a[i][j]);
//            kekw[j].pb(a[i][j]);
        }
    }
    for(int i=0;i<n;i++){
        for(int j=0;j<3;j++){
            int ok=1;
            for(int t=0;t<3;t++){
                if(a[i][t]==mx[t] && j!=t) ok=0;
            }
            if(ok)
                kekw[j].pb(a[i][j]);
        }
    }
    for(int j=0;j<3;j++){
        sort(all(kekw[j]));
        kekw[j].erase(unique(all(kekw[j])),kekw[j].end());
        reverse(all(kekw[j]));
        kekw[j].resize(min(sz(kekw[j]),n));
    }
    auto check=[&](int x,int j){
//        if(x==kekw[j].back() || (sz(kekw[j])>1 && kekw[j][sz(kekw[j])-2]==x))
//            return 1;
        int ok=0;
        for(auto &z : kekw[j]) ok|=(z==x);
        return ok;
    };
    vec<int>ans;
    int mxt=-1;
//    for(i)
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            for(int k=0;k<n;k++){
                if(a[i][0]>max(a[j][0],a[k][0]) &&
                   a[j][1]>max(a[i][1],a[k][1]) &&
                   a[k][2]>max(a[i][2],a[j][2])){
                    if(check(a[i][0],0) || check(a[j][1],1) || check(a[k][2],2)){
                        umax(mxt,a[i][0]+a[j][1]+a[k][2]);
//                        ans={i,j,k};
                    }
                }
            }
        }
    }
    cout<<mxt;
//    if(mxt==-1){
//        cout<<-1;
//        return 0;
//    }
    return 0;
}
/*

*/
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 284 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 272 ms 340 KB Output is correct
15 Correct 24 ms 212 KB Output is correct
16 Correct 56 ms 340 KB Output is correct
17 Correct 47 ms 340 KB Output is correct
18 Correct 105 ms 340 KB Output is correct
19 Correct 100 ms 340 KB Output is correct
20 Correct 39 ms 212 KB Output is correct
21 Correct 30 ms 316 KB Output is correct
22 Correct 38 ms 340 KB Output is correct
23 Correct 21 ms 212 KB Output is correct
24 Correct 27 ms 340 KB Output is correct
25 Correct 27 ms 468 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 284 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 272 ms 340 KB Output is correct
15 Correct 24 ms 212 KB Output is correct
16 Correct 56 ms 340 KB Output is correct
17 Correct 47 ms 340 KB Output is correct
18 Correct 105 ms 340 KB Output is correct
19 Correct 100 ms 340 KB Output is correct
20 Correct 39 ms 212 KB Output is correct
21 Correct 30 ms 316 KB Output is correct
22 Correct 38 ms 340 KB Output is correct
23 Correct 21 ms 212 KB Output is correct
24 Correct 27 ms 340 KB Output is correct
25 Correct 27 ms 468 KB Output is correct
26 Execution timed out 2077 ms 596 KB Time limit exceeded
27 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Execution timed out 2082 ms 9916 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Execution timed out 2082 ms 9916 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Execution timed out 2082 ms 9916 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Execution timed out 2082 ms 9916 KB Time limit exceeded
12 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 284 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 272 ms 340 KB Output is correct
15 Correct 24 ms 212 KB Output is correct
16 Correct 56 ms 340 KB Output is correct
17 Correct 47 ms 340 KB Output is correct
18 Correct 105 ms 340 KB Output is correct
19 Correct 100 ms 340 KB Output is correct
20 Correct 39 ms 212 KB Output is correct
21 Correct 30 ms 316 KB Output is correct
22 Correct 38 ms 340 KB Output is correct
23 Correct 21 ms 212 KB Output is correct
24 Correct 27 ms 340 KB Output is correct
25 Correct 27 ms 468 KB Output is correct
26 Execution timed out 2077 ms 596 KB Time limit exceeded
27 Halted 0 ms 0 KB -