답안 #688107

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
688107 2023-01-27T07:08:45 Z Darren0724 Team Contest (JOI22_team) C++17
35 / 100
65 ms 4736 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){
            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 320 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 1 ms 320 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 320 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 320 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 328 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 324 KB Output is correct
24 Correct 1 ms 316 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 320 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 1 ms 320 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 320 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 320 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 328 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 324 KB Output is correct
24 Correct 1 ms 316 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Incorrect 2 ms 456 KB Output isn't correct
27 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 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 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 36 ms 2616 KB Output is correct
12 Correct 23 ms 2352 KB Output is correct
13 Correct 25 ms 2640 KB Output is correct
14 Correct 35 ms 2980 KB Output is correct
15 Correct 29 ms 3392 KB Output is correct
16 Correct 26 ms 4500 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 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 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 36 ms 2616 KB Output is correct
12 Correct 23 ms 2352 KB Output is correct
13 Correct 25 ms 2640 KB Output is correct
14 Correct 35 ms 2980 KB Output is correct
15 Correct 29 ms 3392 KB Output is correct
16 Correct 26 ms 4500 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 320 KB Output is correct
19 Correct 0 ms 316 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 49 ms 2468 KB Output is correct
23 Correct 41 ms 2500 KB Output is correct
24 Correct 32 ms 2608 KB Output is correct
25 Correct 42 ms 3564 KB Output is correct
26 Correct 38 ms 4124 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 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 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 36 ms 2616 KB Output is correct
12 Correct 23 ms 2352 KB Output is correct
13 Correct 25 ms 2640 KB Output is correct
14 Correct 35 ms 2980 KB Output is correct
15 Correct 29 ms 3392 KB Output is correct
16 Correct 26 ms 4500 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 320 KB Output is correct
19 Correct 0 ms 316 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 49 ms 2468 KB Output is correct
23 Correct 41 ms 2500 KB Output is correct
24 Correct 32 ms 2608 KB Output is correct
25 Correct 42 ms 3564 KB Output is correct
26 Correct 38 ms 4124 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 2 ms 328 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 56 ms 3532 KB Output is correct
35 Correct 55 ms 3276 KB Output is correct
36 Correct 62 ms 3576 KB Output is correct
37 Correct 65 ms 3732 KB Output is correct
38 Correct 39 ms 4736 KB Output is correct
39 Correct 20 ms 3528 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Correct 1 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 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 36 ms 2616 KB Output is correct
12 Correct 23 ms 2352 KB Output is correct
13 Correct 25 ms 2640 KB Output is correct
14 Correct 35 ms 2980 KB Output is correct
15 Correct 29 ms 3392 KB Output is correct
16 Correct 26 ms 4500 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 320 KB Output is correct
19 Correct 0 ms 316 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 49 ms 2468 KB Output is correct
23 Correct 41 ms 2500 KB Output is correct
24 Correct 32 ms 2608 KB Output is correct
25 Correct 42 ms 3564 KB Output is correct
26 Correct 38 ms 4124 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
29 Correct 1 ms 212 KB Output is correct
30 Correct 0 ms 212 KB Output is correct
31 Correct 2 ms 328 KB Output is correct
32 Correct 1 ms 340 KB Output is correct
33 Correct 1 ms 340 KB Output is correct
34 Correct 56 ms 3532 KB Output is correct
35 Correct 55 ms 3276 KB Output is correct
36 Correct 62 ms 3576 KB Output is correct
37 Correct 65 ms 3732 KB Output is correct
38 Correct 39 ms 4736 KB Output is correct
39 Correct 20 ms 3528 KB Output is correct
40 Incorrect 2 ms 340 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 320 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 1 ms 320 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 320 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 320 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 328 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 324 KB Output is correct
24 Correct 1 ms 316 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Incorrect 2 ms 456 KB Output isn't correct
27 Halted 0 ms 0 KB -