답안 #688115

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
688115 2023-01-27T07:14:01 Z Darren0724 Team Contest (JOI22_team) C++17
35 / 100
77 ms 4900 KB
#include<bits/stdc++.h>
using namespace std;
#define x first
#define y second
#define pii pair<int,int>
#define all(x) x.begin(),x.end()
const int INF=1e9;

signed main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    int n;cin>>n;
    vector<pair<int,pii>> v(n);
    for(int i=0;i<n;i++){
        cin>>v[i].x>>v[i].y.x>>v[i].y.y;
    }
    sort(all(v));
    vector<pii> q;
    set<pii> s,c;
    int ans=-1;
    for(int i=0;i<n;i++){
        pii t=v[i].y;
        if(i>0&&v[i].x>v[i-1].x){
            random_shuffle(all(q));
            for(auto t:q){
                auto it=c.lower_bound(t);
                if(it!=c.begin()&&(*prev(it)).y>t.y){
                    continue;
                }
                c.insert(t);
                it=c.lower_bound(t);
                it++;
                while(it!=c.end()){
                    if(t.y>(*it).y){
                        c.erase(it);
                        it=c.lower_bound(t);
                        it++;
                    }
                    else{
                        break;
                    }
                }

            }
            for(auto t:q){
                auto it=c.upper_bound({t.x,0});
                int tmp=-1;
                if(it!=c.begin()&&(*prev(it)).y>t.y){
                    tmp=(*prev(it)).y;
                }
                if(tmp==-1){
                    continue;
                }
                s.insert({t.x,tmp});
                while(s.size()>1){
                    s.erase(s.begin());
                }
            }
            q.clear();
        }
        //cout<<s.size()<<endl;
        q.push_back(v[i].y);
        auto it=s.upper_bound({t.x,INF});
        if(it==s.end()||(*it).y<=t.y){
            continue;
        }

        ans=max(ans,v[i].x+(*it).x+(*it).y);
    }
    cout<<ans<<endl;

    return 0;
}

# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 320 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 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 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 320 KB Output is correct
14 Correct 1 ms 324 KB Output is correct
15 Correct 1 ms 324 KB Output is correct
16 Correct 1 ms 324 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 320 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 320 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 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 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 320 KB Output is correct
14 Correct 1 ms 324 KB Output is correct
15 Correct 1 ms 324 KB Output is correct
16 Correct 1 ms 324 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 320 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Incorrect 2 ms 468 KB Output isn't correct
27 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 0 ms 324 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 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 320 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 44 ms 3100 KB Output is correct
12 Correct 34 ms 2712 KB Output is correct
13 Correct 29 ms 3024 KB Output is correct
14 Correct 42 ms 3352 KB Output is correct
15 Correct 30 ms 3784 KB Output is correct
16 Correct 27 ms 4900 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 0 ms 324 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 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 320 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 44 ms 3100 KB Output is correct
12 Correct 34 ms 2712 KB Output is correct
13 Correct 29 ms 3024 KB Output is correct
14 Correct 42 ms 3352 KB Output is correct
15 Correct 30 ms 3784 KB Output is correct
16 Correct 27 ms 4900 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 320 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 63 ms 2944 KB Output is correct
23 Correct 51 ms 2884 KB Output is correct
24 Correct 39 ms 2380 KB Output is correct
25 Correct 52 ms 3092 KB Output is correct
26 Correct 31 ms 3804 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 0 ms 324 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 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 320 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 44 ms 3100 KB Output is correct
12 Correct 34 ms 2712 KB Output is correct
13 Correct 29 ms 3024 KB Output is correct
14 Correct 42 ms 3352 KB Output is correct
15 Correct 30 ms 3784 KB Output is correct
16 Correct 27 ms 4900 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 320 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 63 ms 2944 KB Output is correct
23 Correct 51 ms 2884 KB Output is correct
24 Correct 39 ms 2380 KB Output is correct
25 Correct 52 ms 3092 KB Output is correct
26 Correct 31 ms 3804 KB Output is correct
27 Correct 1 ms 320 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 320 KB Output is correct
30 Correct 1 ms 324 KB Output is correct
31 Correct 3 ms 420 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 64 ms 2636 KB Output is correct
35 Correct 68 ms 2508 KB Output is correct
36 Correct 77 ms 2652 KB Output is correct
37 Correct 75 ms 2696 KB Output is correct
38 Correct 38 ms 3732 KB Output is correct
39 Correct 20 ms 3168 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 324 KB Output is correct
3 Correct 0 ms 324 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 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 320 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 44 ms 3100 KB Output is correct
12 Correct 34 ms 2712 KB Output is correct
13 Correct 29 ms 3024 KB Output is correct
14 Correct 42 ms 3352 KB Output is correct
15 Correct 30 ms 3784 KB Output is correct
16 Correct 27 ms 4900 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 320 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 63 ms 2944 KB Output is correct
23 Correct 51 ms 2884 KB Output is correct
24 Correct 39 ms 2380 KB Output is correct
25 Correct 52 ms 3092 KB Output is correct
26 Correct 31 ms 3804 KB Output is correct
27 Correct 1 ms 320 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 320 KB Output is correct
30 Correct 1 ms 324 KB Output is correct
31 Correct 3 ms 420 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 64 ms 2636 KB Output is correct
35 Correct 68 ms 2508 KB Output is correct
36 Correct 77 ms 2652 KB Output is correct
37 Correct 75 ms 2696 KB Output is correct
38 Correct 38 ms 3732 KB Output is correct
39 Correct 20 ms 3168 KB Output is correct
40 Incorrect 2 ms 336 KB Output isn't correct
41 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 316 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 320 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 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 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 320 KB Output is correct
14 Correct 1 ms 324 KB Output is correct
15 Correct 1 ms 324 KB Output is correct
16 Correct 1 ms 324 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 320 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Incorrect 2 ms 468 KB Output isn't correct
27 Halted 0 ms 0 KB -