답안 #713862

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
713862 2023-03-23T06:29:06 Z 089487 Team Contest (JOI22_team) C++14
64 / 100
2000 ms 18348 KB
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx,popcnt,sse4,abm")
#include<bits/stdc++.h>
#define int long long
#define quick ios::sync_with_stdio(0);cin.tie(0);
#define rep(x,a,b) for(int x=a;x<=b;x++)
#define repd(x,a,b) for(int x=a;x>=b;x--)
#define lowbit(x) (x&-x)
#define sz(x) (int)(x.size())
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define mp make_pair
#define eb emplace_back
using namespace std;
typedef pair<int,int> pii;
void debug(){
    cout<<"\n";
}
template <class T,class ... U >
void debug(T a, U ... b){
    cout<<a<<" ",debug(b...);
}
const int N=2e5+7;
const int INF=1e18;
int bit[N];
int x[N];
int y[N];
int z[N];
vector<pii> v[N];
int yz[N];
void upd(int x,int val){
	for(;x<N;x+=lowbit(x)) bit[x]=max(bit[x],val);
}
int qry(int x){
	int ret=0;
	for(;x>0;x-=lowbit(x)) ret=max(ret,bit[x]);
	return ret;
}
signed main(){
	quick
	int n;
	cin>>n;
	vector<int> vx;
	vector<int> vy;
	vector<int> vz;
	rep(i,0,n-1){
		cin>>x[i]>>y[i]>>z[i];
		vx.eb(x[i]);
		vy.eb(y[i]);
		vz.eb(z[i]);
	}	
	sort(all(vx));
	sort(all(vy));
	sort(all(vz));
	vx.erase(unique(all(vx)),vx.end());
	vy.erase(unique(all(vy)),vy.end());
	vz.erase(unique(all(vz)),vz.end());
	int ans=-1;
	rep(i,0,n-1){
		x[i]=upper_bound(all(vx),x[i])-vx.begin();
		y[i]=upper_bound(all(vy),y[i])-vy.begin();
		z[i]=upper_bound(all(vz),z[i])-vz.begin();
		v[x[i]].eb(mp(y[i],z[i]));
		yz[y[i]]=INF;
	}
	
	rep(i,1,sz(vx)){
		for(pii p2:v[i]){
			rep(yi,p2.F+1,sz(vy)){
				int pz=max(p2.S,yz[yi]);
				int q=qry(yi-1);
				if(q>pz){
					ans=max(ans,vx[i-1]+vy[yi-1]+vz[q-1]);
				}
			}
		}
		for(pii p2:v[i]){
			yz[p2.F]=min(yz[p2.F],p2.S);
			upd(p2.F,p2.S);
		}
	}
	cout<<ans<<"\n";

	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 5076 KB Output is correct
2 Correct 4 ms 5076 KB Output is correct
3 Correct 4 ms 5076 KB Output is correct
4 Correct 4 ms 5076 KB Output is correct
5 Correct 3 ms 5076 KB Output is correct
6 Correct 3 ms 5076 KB Output is correct
7 Correct 4 ms 5076 KB Output is correct
8 Correct 4 ms 5080 KB Output is correct
9 Correct 3 ms 5076 KB Output is correct
10 Correct 3 ms 5076 KB Output is correct
11 Correct 4 ms 5076 KB Output is correct
12 Correct 4 ms 5076 KB Output is correct
13 Correct 3 ms 5076 KB Output is correct
14 Correct 4 ms 5076 KB Output is correct
15 Correct 4 ms 5076 KB Output is correct
16 Correct 3 ms 5076 KB Output is correct
17 Correct 3 ms 5076 KB Output is correct
18 Correct 3 ms 5076 KB Output is correct
19 Correct 4 ms 5076 KB Output is correct
20 Correct 3 ms 5076 KB Output is correct
21 Correct 3 ms 5076 KB Output is correct
22 Correct 6 ms 5076 KB Output is correct
23 Correct 5 ms 5072 KB Output is correct
24 Correct 4 ms 5056 KB Output is correct
25 Correct 3 ms 5076 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 5076 KB Output is correct
2 Correct 4 ms 5076 KB Output is correct
3 Correct 4 ms 5076 KB Output is correct
4 Correct 4 ms 5076 KB Output is correct
5 Correct 3 ms 5076 KB Output is correct
6 Correct 3 ms 5076 KB Output is correct
7 Correct 4 ms 5076 KB Output is correct
8 Correct 4 ms 5080 KB Output is correct
9 Correct 3 ms 5076 KB Output is correct
10 Correct 3 ms 5076 KB Output is correct
11 Correct 4 ms 5076 KB Output is correct
12 Correct 4 ms 5076 KB Output is correct
13 Correct 3 ms 5076 KB Output is correct
14 Correct 4 ms 5076 KB Output is correct
15 Correct 4 ms 5076 KB Output is correct
16 Correct 3 ms 5076 KB Output is correct
17 Correct 3 ms 5076 KB Output is correct
18 Correct 3 ms 5076 KB Output is correct
19 Correct 4 ms 5076 KB Output is correct
20 Correct 3 ms 5076 KB Output is correct
21 Correct 3 ms 5076 KB Output is correct
22 Correct 6 ms 5076 KB Output is correct
23 Correct 5 ms 5072 KB Output is correct
24 Correct 4 ms 5056 KB Output is correct
25 Correct 3 ms 5076 KB Output is correct
26 Correct 110 ms 5452 KB Output is correct
27 Correct 58 ms 5408 KB Output is correct
28 Correct 72 ms 5332 KB Output is correct
29 Correct 36 ms 5332 KB Output is correct
30 Correct 21 ms 5204 KB Output is correct
31 Correct 29 ms 5332 KB Output is correct
32 Correct 7 ms 5376 KB Output is correct
33 Correct 8 ms 5332 KB Output is correct
34 Correct 79 ms 5420 KB Output is correct
35 Correct 4 ms 5076 KB Output is correct
36 Correct 4 ms 5124 KB Output is correct
37 Correct 26 ms 5392 KB Output is correct
38 Correct 26 ms 5332 KB Output is correct
39 Correct 4 ms 5204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 5076 KB Output is correct
2 Correct 3 ms 5076 KB Output is correct
3 Correct 4 ms 5076 KB Output is correct
4 Correct 3 ms 5076 KB Output is correct
5 Correct 3 ms 5076 KB Output is correct
6 Correct 3 ms 5084 KB Output is correct
7 Correct 3 ms 5068 KB Output is correct
8 Correct 3 ms 5076 KB Output is correct
9 Correct 3 ms 5076 KB Output is correct
10 Correct 3 ms 5076 KB Output is correct
11 Correct 57 ms 15312 KB Output is correct
12 Correct 40 ms 12348 KB Output is correct
13 Correct 44 ms 13896 KB Output is correct
14 Correct 60 ms 16572 KB Output is correct
15 Correct 51 ms 15820 KB Output is correct
16 Correct 48 ms 16296 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 5076 KB Output is correct
2 Correct 3 ms 5076 KB Output is correct
3 Correct 4 ms 5076 KB Output is correct
4 Correct 3 ms 5076 KB Output is correct
5 Correct 3 ms 5076 KB Output is correct
6 Correct 3 ms 5084 KB Output is correct
7 Correct 3 ms 5068 KB Output is correct
8 Correct 3 ms 5076 KB Output is correct
9 Correct 3 ms 5076 KB Output is correct
10 Correct 3 ms 5076 KB Output is correct
11 Correct 57 ms 15312 KB Output is correct
12 Correct 40 ms 12348 KB Output is correct
13 Correct 44 ms 13896 KB Output is correct
14 Correct 60 ms 16572 KB Output is correct
15 Correct 51 ms 15820 KB Output is correct
16 Correct 48 ms 16296 KB Output is correct
17 Correct 3 ms 5076 KB Output is correct
18 Correct 3 ms 5076 KB Output is correct
19 Correct 3 ms 5076 KB Output is correct
20 Correct 4 ms 5096 KB Output is correct
21 Correct 4 ms 5160 KB Output is correct
22 Correct 83 ms 15036 KB Output is correct
23 Correct 68 ms 14572 KB Output is correct
24 Correct 51 ms 12544 KB Output is correct
25 Correct 72 ms 15468 KB Output is correct
26 Correct 54 ms 15820 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 5076 KB Output is correct
2 Correct 3 ms 5076 KB Output is correct
3 Correct 4 ms 5076 KB Output is correct
4 Correct 3 ms 5076 KB Output is correct
5 Correct 3 ms 5076 KB Output is correct
6 Correct 3 ms 5084 KB Output is correct
7 Correct 3 ms 5068 KB Output is correct
8 Correct 3 ms 5076 KB Output is correct
9 Correct 3 ms 5076 KB Output is correct
10 Correct 3 ms 5076 KB Output is correct
11 Correct 57 ms 15312 KB Output is correct
12 Correct 40 ms 12348 KB Output is correct
13 Correct 44 ms 13896 KB Output is correct
14 Correct 60 ms 16572 KB Output is correct
15 Correct 51 ms 15820 KB Output is correct
16 Correct 48 ms 16296 KB Output is correct
17 Correct 3 ms 5076 KB Output is correct
18 Correct 3 ms 5076 KB Output is correct
19 Correct 3 ms 5076 KB Output is correct
20 Correct 4 ms 5096 KB Output is correct
21 Correct 4 ms 5160 KB Output is correct
22 Correct 83 ms 15036 KB Output is correct
23 Correct 68 ms 14572 KB Output is correct
24 Correct 51 ms 12544 KB Output is correct
25 Correct 72 ms 15468 KB Output is correct
26 Correct 54 ms 15820 KB Output is correct
27 Correct 4 ms 5076 KB Output is correct
28 Correct 4 ms 5128 KB Output is correct
29 Correct 3 ms 5076 KB Output is correct
30 Correct 3 ms 5200 KB Output is correct
31 Correct 8 ms 5332 KB Output is correct
32 Correct 4 ms 5076 KB Output is correct
33 Correct 4 ms 5076 KB Output is correct
34 Correct 216 ms 14576 KB Output is correct
35 Correct 226 ms 16440 KB Output is correct
36 Correct 250 ms 17204 KB Output is correct
37 Correct 179 ms 17004 KB Output is correct
38 Correct 90 ms 17284 KB Output is correct
39 Correct 120 ms 12440 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 5076 KB Output is correct
2 Correct 3 ms 5076 KB Output is correct
3 Correct 4 ms 5076 KB Output is correct
4 Correct 3 ms 5076 KB Output is correct
5 Correct 3 ms 5076 KB Output is correct
6 Correct 3 ms 5084 KB Output is correct
7 Correct 3 ms 5068 KB Output is correct
8 Correct 3 ms 5076 KB Output is correct
9 Correct 3 ms 5076 KB Output is correct
10 Correct 3 ms 5076 KB Output is correct
11 Correct 57 ms 15312 KB Output is correct
12 Correct 40 ms 12348 KB Output is correct
13 Correct 44 ms 13896 KB Output is correct
14 Correct 60 ms 16572 KB Output is correct
15 Correct 51 ms 15820 KB Output is correct
16 Correct 48 ms 16296 KB Output is correct
17 Correct 3 ms 5076 KB Output is correct
18 Correct 3 ms 5076 KB Output is correct
19 Correct 3 ms 5076 KB Output is correct
20 Correct 4 ms 5096 KB Output is correct
21 Correct 4 ms 5160 KB Output is correct
22 Correct 83 ms 15036 KB Output is correct
23 Correct 68 ms 14572 KB Output is correct
24 Correct 51 ms 12544 KB Output is correct
25 Correct 72 ms 15468 KB Output is correct
26 Correct 54 ms 15820 KB Output is correct
27 Correct 4 ms 5076 KB Output is correct
28 Correct 4 ms 5128 KB Output is correct
29 Correct 3 ms 5076 KB Output is correct
30 Correct 3 ms 5200 KB Output is correct
31 Correct 8 ms 5332 KB Output is correct
32 Correct 4 ms 5076 KB Output is correct
33 Correct 4 ms 5076 KB Output is correct
34 Correct 216 ms 14576 KB Output is correct
35 Correct 226 ms 16440 KB Output is correct
36 Correct 250 ms 17204 KB Output is correct
37 Correct 179 ms 17004 KB Output is correct
38 Correct 90 ms 17284 KB Output is correct
39 Correct 120 ms 12440 KB Output is correct
40 Correct 23 ms 5336 KB Output is correct
41 Correct 28 ms 5332 KB Output is correct
42 Correct 24 ms 5436 KB Output is correct
43 Correct 25 ms 5332 KB Output is correct
44 Execution timed out 2072 ms 18348 KB Time limit exceeded
45 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 5076 KB Output is correct
2 Correct 4 ms 5076 KB Output is correct
3 Correct 4 ms 5076 KB Output is correct
4 Correct 4 ms 5076 KB Output is correct
5 Correct 3 ms 5076 KB Output is correct
6 Correct 3 ms 5076 KB Output is correct
7 Correct 4 ms 5076 KB Output is correct
8 Correct 4 ms 5080 KB Output is correct
9 Correct 3 ms 5076 KB Output is correct
10 Correct 3 ms 5076 KB Output is correct
11 Correct 4 ms 5076 KB Output is correct
12 Correct 4 ms 5076 KB Output is correct
13 Correct 3 ms 5076 KB Output is correct
14 Correct 4 ms 5076 KB Output is correct
15 Correct 4 ms 5076 KB Output is correct
16 Correct 3 ms 5076 KB Output is correct
17 Correct 3 ms 5076 KB Output is correct
18 Correct 3 ms 5076 KB Output is correct
19 Correct 4 ms 5076 KB Output is correct
20 Correct 3 ms 5076 KB Output is correct
21 Correct 3 ms 5076 KB Output is correct
22 Correct 6 ms 5076 KB Output is correct
23 Correct 5 ms 5072 KB Output is correct
24 Correct 4 ms 5056 KB Output is correct
25 Correct 3 ms 5076 KB Output is correct
26 Correct 110 ms 5452 KB Output is correct
27 Correct 58 ms 5408 KB Output is correct
28 Correct 72 ms 5332 KB Output is correct
29 Correct 36 ms 5332 KB Output is correct
30 Correct 21 ms 5204 KB Output is correct
31 Correct 29 ms 5332 KB Output is correct
32 Correct 7 ms 5376 KB Output is correct
33 Correct 8 ms 5332 KB Output is correct
34 Correct 79 ms 5420 KB Output is correct
35 Correct 4 ms 5076 KB Output is correct
36 Correct 4 ms 5124 KB Output is correct
37 Correct 26 ms 5392 KB Output is correct
38 Correct 26 ms 5332 KB Output is correct
39 Correct 4 ms 5204 KB Output is correct
40 Correct 4 ms 5076 KB Output is correct
41 Correct 3 ms 5076 KB Output is correct
42 Correct 4 ms 5076 KB Output is correct
43 Correct 3 ms 5076 KB Output is correct
44 Correct 3 ms 5076 KB Output is correct
45 Correct 3 ms 5084 KB Output is correct
46 Correct 3 ms 5068 KB Output is correct
47 Correct 3 ms 5076 KB Output is correct
48 Correct 3 ms 5076 KB Output is correct
49 Correct 3 ms 5076 KB Output is correct
50 Correct 57 ms 15312 KB Output is correct
51 Correct 40 ms 12348 KB Output is correct
52 Correct 44 ms 13896 KB Output is correct
53 Correct 60 ms 16572 KB Output is correct
54 Correct 51 ms 15820 KB Output is correct
55 Correct 48 ms 16296 KB Output is correct
56 Correct 3 ms 5076 KB Output is correct
57 Correct 3 ms 5076 KB Output is correct
58 Correct 3 ms 5076 KB Output is correct
59 Correct 4 ms 5096 KB Output is correct
60 Correct 4 ms 5160 KB Output is correct
61 Correct 83 ms 15036 KB Output is correct
62 Correct 68 ms 14572 KB Output is correct
63 Correct 51 ms 12544 KB Output is correct
64 Correct 72 ms 15468 KB Output is correct
65 Correct 54 ms 15820 KB Output is correct
66 Correct 4 ms 5076 KB Output is correct
67 Correct 4 ms 5128 KB Output is correct
68 Correct 3 ms 5076 KB Output is correct
69 Correct 3 ms 5200 KB Output is correct
70 Correct 8 ms 5332 KB Output is correct
71 Correct 4 ms 5076 KB Output is correct
72 Correct 4 ms 5076 KB Output is correct
73 Correct 216 ms 14576 KB Output is correct
74 Correct 226 ms 16440 KB Output is correct
75 Correct 250 ms 17204 KB Output is correct
76 Correct 179 ms 17004 KB Output is correct
77 Correct 90 ms 17284 KB Output is correct
78 Correct 120 ms 12440 KB Output is correct
79 Correct 23 ms 5336 KB Output is correct
80 Correct 28 ms 5332 KB Output is correct
81 Correct 24 ms 5436 KB Output is correct
82 Correct 25 ms 5332 KB Output is correct
83 Execution timed out 2072 ms 18348 KB Time limit exceeded
84 Halted 0 ms 0 KB -