Submission #770288

# Submission time Handle Problem Language Result Execution time Memory
770288 2023-07-01T04:54:57 Z ttamx Team Contest (JOI22_team) C++14
0 / 100
42 ms 15232 KB
#include<bits/stdc++.h>

using namespace std;

typedef long long ll;

const int N=150005;

int n,nx,ny,nz;
int x[N],y[N],z[N];
vector<ll> px,py,pz;
vector<int> vx[N],vy[N];
int mx[N];
ll mx2[N];
ll ans=-1;

int main(){
    cin.tie(nullptr)->sync_with_stdio(false);
    cin >> n;
    for(int i=1;i<=n;i++){
        cin >> x[i] >> y[i] >> z[i];
        px.emplace_back(x[i]);
        py.emplace_back(y[i]);
        pz.emplace_back(z[i]);
    }
    px.emplace_back(-1e18);
    py.emplace_back(-1e18);
    pz.emplace_back(-1e18);
    sort(px.begin(),px.end());
    sort(py.begin(),py.end());
    sort(pz.begin(),pz.end());
    px.erase(unique(px.begin(),px.end()),px.end());
    py.erase(unique(py.begin(),py.end()),py.end());
    pz.erase(unique(pz.begin(),pz.end()),pz.end());
    nx=px.size();
    ny=py.size();
    nz=pz.size();
    for(int i=1;i<=n;i++){
        x[i]=lower_bound(px.begin(),px.end(),x[i])-px.begin();
        y[i]=lower_bound(py.begin(),py.end(),y[i])-py.begin();
        z[i]=lower_bound(pz.begin(),pz.end(),z[i])-pz.begin();
        vx[x[i]].emplace_back(i);
    }
    for(int i=1;i<=nx;i++){
        if(vx[i].empty())continue;
        int idx=0;
        for(int j=1;j<=ny;j++){
            mx[j]=0;
            int mn=nz+1;
            for(auto k:vy[j])mn=min(mn,z[k]);
            if(idx>mn)mx[j]=idx;
            for(auto k:vy[j])idx=max(idx,z[k]);
        }
        mx2[n+1]=-1e18;
        for(int i=n;i>=1;i--)mx2[i]=max(mx2[i+1],py[i]+pz[mx[i]]);
        for(auto j:vx[i])ans=max(ans,px[i]+mx2[y[j]+1]);
        for(auto j:vx[i])vy[y[j]].emplace_back(j);
    }
    cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 3 ms 7380 KB Output is correct
2 Correct 3 ms 7380 KB Output is correct
3 Correct 3 ms 7380 KB Output is correct
4 Correct 3 ms 7380 KB Output is correct
5 Correct 3 ms 7380 KB Output is correct
6 Correct 3 ms 7380 KB Output is correct
7 Correct 3 ms 7380 KB Output is correct
8 Correct 3 ms 7380 KB Output is correct
9 Correct 3 ms 7380 KB Output is correct
10 Correct 3 ms 7380 KB Output is correct
11 Correct 3 ms 7380 KB Output is correct
12 Correct 3 ms 7380 KB Output is correct
13 Correct 3 ms 7380 KB Output is correct
14 Correct 4 ms 7380 KB Output is correct
15 Incorrect 3 ms 7380 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 7380 KB Output is correct
2 Correct 3 ms 7380 KB Output is correct
3 Correct 3 ms 7380 KB Output is correct
4 Correct 3 ms 7380 KB Output is correct
5 Correct 3 ms 7380 KB Output is correct
6 Correct 3 ms 7380 KB Output is correct
7 Correct 3 ms 7380 KB Output is correct
8 Correct 3 ms 7380 KB Output is correct
9 Correct 3 ms 7380 KB Output is correct
10 Correct 3 ms 7380 KB Output is correct
11 Correct 3 ms 7380 KB Output is correct
12 Correct 3 ms 7380 KB Output is correct
13 Correct 3 ms 7380 KB Output is correct
14 Correct 4 ms 7380 KB Output is correct
15 Incorrect 3 ms 7380 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 7388 KB Output is correct
2 Correct 3 ms 7380 KB Output is correct
3 Correct 3 ms 7380 KB Output is correct
4 Correct 3 ms 7312 KB Output is correct
5 Correct 3 ms 7380 KB Output is correct
6 Correct 3 ms 7380 KB Output is correct
7 Correct 3 ms 7380 KB Output is correct
8 Correct 3 ms 7380 KB Output is correct
9 Correct 3 ms 7380 KB Output is correct
10 Correct 4 ms 7380 KB Output is correct
11 Correct 42 ms 15232 KB Output is correct
12 Incorrect 29 ms 13272 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 7388 KB Output is correct
2 Correct 3 ms 7380 KB Output is correct
3 Correct 3 ms 7380 KB Output is correct
4 Correct 3 ms 7312 KB Output is correct
5 Correct 3 ms 7380 KB Output is correct
6 Correct 3 ms 7380 KB Output is correct
7 Correct 3 ms 7380 KB Output is correct
8 Correct 3 ms 7380 KB Output is correct
9 Correct 3 ms 7380 KB Output is correct
10 Correct 4 ms 7380 KB Output is correct
11 Correct 42 ms 15232 KB Output is correct
12 Incorrect 29 ms 13272 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 7388 KB Output is correct
2 Correct 3 ms 7380 KB Output is correct
3 Correct 3 ms 7380 KB Output is correct
4 Correct 3 ms 7312 KB Output is correct
5 Correct 3 ms 7380 KB Output is correct
6 Correct 3 ms 7380 KB Output is correct
7 Correct 3 ms 7380 KB Output is correct
8 Correct 3 ms 7380 KB Output is correct
9 Correct 3 ms 7380 KB Output is correct
10 Correct 4 ms 7380 KB Output is correct
11 Correct 42 ms 15232 KB Output is correct
12 Incorrect 29 ms 13272 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 7388 KB Output is correct
2 Correct 3 ms 7380 KB Output is correct
3 Correct 3 ms 7380 KB Output is correct
4 Correct 3 ms 7312 KB Output is correct
5 Correct 3 ms 7380 KB Output is correct
6 Correct 3 ms 7380 KB Output is correct
7 Correct 3 ms 7380 KB Output is correct
8 Correct 3 ms 7380 KB Output is correct
9 Correct 3 ms 7380 KB Output is correct
10 Correct 4 ms 7380 KB Output is correct
11 Correct 42 ms 15232 KB Output is correct
12 Incorrect 29 ms 13272 KB Output isn't correct
13 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 7380 KB Output is correct
2 Correct 3 ms 7380 KB Output is correct
3 Correct 3 ms 7380 KB Output is correct
4 Correct 3 ms 7380 KB Output is correct
5 Correct 3 ms 7380 KB Output is correct
6 Correct 3 ms 7380 KB Output is correct
7 Correct 3 ms 7380 KB Output is correct
8 Correct 3 ms 7380 KB Output is correct
9 Correct 3 ms 7380 KB Output is correct
10 Correct 3 ms 7380 KB Output is correct
11 Correct 3 ms 7380 KB Output is correct
12 Correct 3 ms 7380 KB Output is correct
13 Correct 3 ms 7380 KB Output is correct
14 Correct 4 ms 7380 KB Output is correct
15 Incorrect 3 ms 7380 KB Output isn't correct
16 Halted 0 ms 0 KB -