Submission #892172

# Submission time Handle Problem Language Result Execution time Memory
892172 2023-12-25T03:09:54 Z vjudge1 Team Contest (JOI22_team) C++17
17 / 100
2000 ms 13824 KB
#include <bits/stdc++.h>
#define int long long
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define pb push_back
using namespace std;
signed main(){
    int n;
    cin>>n;
    vector <vector <int> > a;
    int mxx=0,mxy=0,mxz=0;
    map <vector <int> ,int> mp;
    for(int i=0;i<n;i++){
        int x,y,z;
        cin>>x>>y>>z;
        a.pb({x,y,z});
        mxx=max(mxx,x);
        mxy=max(mxy,y);
        mxz=max(mxz,z);
        mp[{x,y,z}]++;
    }
    
    
    if(n<=300){
        int res=0;
        for(int i=0;i<n;i++){
            for(int j=i+1;j<n;j++){
                for(int k=j+1;k<n;k++){
                    bool flag=true;
                    int ans=0;
                    set <int> st;
                    for(int t=0;t<3;t++){
                        int mx=0,cnt=0,x=-1;
                        mx=max(a[i][t],mx);
                        mx=max(a[j][t],mx);
                        mx=max(a[k][t],mx);
                        if(mx==a[i][t]){
                            cnt++;x=i;
                        }
                        if(mx==a[j][t]){
                            cnt++;x=j;
                        }
                        if(mx==a[k][t]){
                            cnt++;x=k;
                        }
                        if(cnt==1){
                            ans+=mx;
                            st.insert(x);
                        }
                        else flag=false;
                    }
                    if(flag && st.size()==3)res=max(res,ans);
                }
            }
        }
        if(res==0)res=-1;
        cout<<res<<"\n";return 0;
    }
    
    int mx=-1;
    for(int i=1;i<=mxx;i++){
        for(int j=1;j<=mxy;j++){
            for(int k=1;k<=mxz;k++){
                bool ok1=0,ok2=0,ok3=0;
                for(auto x : mp){
                    vector <int> v=x.ff;
                    if(v[0]==i && v[1]<j && v[2]<k)ok1=1;
                    if(v[0]<i && v[1]==j && v[2]<k)ok2=1;
                    if(v[0]<i && v[1]<j && v[2]==k)ok3=1;
                }
                if(ok1 && ok2 && ok3)mx=max(mx,i+j+k);
            }
        }
    }
    cout<<mx<<"\n";
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 436 KB Output is correct
14 Correct 270 ms 348 KB Output is correct
15 Correct 105 ms 452 KB Output is correct
16 Correct 168 ms 460 KB Output is correct
17 Correct 202 ms 348 KB Output is correct
18 Correct 216 ms 464 KB Output is correct
19 Correct 251 ms 600 KB Output is correct
20 Correct 234 ms 348 KB Output is correct
21 Correct 87 ms 452 KB Output is correct
22 Correct 117 ms 464 KB Output is correct
23 Correct 34 ms 344 KB Output is correct
24 Correct 124 ms 348 KB Output is correct
25 Correct 114 ms 460 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 436 KB Output is correct
14 Correct 270 ms 348 KB Output is correct
15 Correct 105 ms 452 KB Output is correct
16 Correct 168 ms 460 KB Output is correct
17 Correct 202 ms 348 KB Output is correct
18 Correct 216 ms 464 KB Output is correct
19 Correct 251 ms 600 KB Output is correct
20 Correct 234 ms 348 KB Output is correct
21 Correct 87 ms 452 KB Output is correct
22 Correct 117 ms 464 KB Output is correct
23 Correct 34 ms 344 KB Output is correct
24 Correct 124 ms 348 KB Output is correct
25 Correct 114 ms 460 KB Output is correct
26 Execution timed out 2043 ms 860 KB Time limit exceeded
27 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 68 ms 12032 KB Output is correct
12 Correct 44 ms 6160 KB Output is correct
13 Correct 64 ms 7772 KB Output is correct
14 Correct 67 ms 11620 KB Output is correct
15 Correct 64 ms 11532 KB Output is correct
16 Correct 62 ms 12004 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 68 ms 12032 KB Output is correct
12 Correct 44 ms 6160 KB Output is correct
13 Correct 64 ms 7772 KB Output is correct
14 Correct 67 ms 11620 KB Output is correct
15 Correct 64 ms 11532 KB Output is correct
16 Correct 62 ms 12004 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 236 ms 456 KB Output is correct
21 Correct 548 ms 600 KB Output is correct
22 Execution timed out 2039 ms 13824 KB Time limit exceeded
23 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 68 ms 12032 KB Output is correct
12 Correct 44 ms 6160 KB Output is correct
13 Correct 64 ms 7772 KB Output is correct
14 Correct 67 ms 11620 KB Output is correct
15 Correct 64 ms 11532 KB Output is correct
16 Correct 62 ms 12004 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 236 ms 456 KB Output is correct
21 Correct 548 ms 600 KB Output is correct
22 Execution timed out 2039 ms 13824 KB Time limit exceeded
23 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 68 ms 12032 KB Output is correct
12 Correct 44 ms 6160 KB Output is correct
13 Correct 64 ms 7772 KB Output is correct
14 Correct 67 ms 11620 KB Output is correct
15 Correct 64 ms 11532 KB Output is correct
16 Correct 62 ms 12004 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 236 ms 456 KB Output is correct
21 Correct 548 ms 600 KB Output is correct
22 Execution timed out 2039 ms 13824 KB Time limit exceeded
23 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 436 KB Output is correct
14 Correct 270 ms 348 KB Output is correct
15 Correct 105 ms 452 KB Output is correct
16 Correct 168 ms 460 KB Output is correct
17 Correct 202 ms 348 KB Output is correct
18 Correct 216 ms 464 KB Output is correct
19 Correct 251 ms 600 KB Output is correct
20 Correct 234 ms 348 KB Output is correct
21 Correct 87 ms 452 KB Output is correct
22 Correct 117 ms 464 KB Output is correct
23 Correct 34 ms 344 KB Output is correct
24 Correct 124 ms 348 KB Output is correct
25 Correct 114 ms 460 KB Output is correct
26 Execution timed out 2043 ms 860 KB Time limit exceeded
27 Halted 0 ms 0 KB -