답안 #602247

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
602247 2022-07-22T18:53:23 Z uncripted Team Contest (JOI22_team) C++11
0 / 100
79 ms 2040 KB
#include<bits/stdc++.h>
#define f first
#define s second
#define pb push_back
using namespace std;
int main(){
	int n;
	cin>>n;
	pair<int, pair<int,int> >  p[n+1];
	set<pair<int, pair<int,int> > > sd;
	for(int i=1; i<=n; i++){
		int x,y,z;
		cin>>x>>y>>z;
		p[i]={x, {y,z}};
		sd.insert(p[i]);
	}
	sort(p+1, p+n+1, greater<pair<int, pair<int,int> > >() );
	int pas=-1;	
	set<pair<int, pair<int,int> > >::iterator it=sd.end();
	it--;	
		set<pair<int,int> > vx,vy;	
	while(true){
				pair<int, pair<int,int> > px;
				px=*it;
				vx.insert({px.s.f, px.s.s});
				vy.insert({px.s.s, px.s.f});
				if(it==sd.begin()){
					break;
				}
				it--;
	}	

	for(int i=1; i<=n; i++){
	
		if(vx.find({p[i].s.f, p[i].s.s})==vx.end()){
				vx.erase({p[i].s.f, p[i].s.s});
		}
		if(vy.find({p[i].s.s, p[i].s.f})==vy.end()){
				vy.erase({p[i].s.s, p[i].s.f});
		}
	set<pair<int, pair<int,int> > >::iterator it=sd.lower_bound({p[i].f, {0, 0}});
		if(it==sd.begin()){
			continue;
		}
		it--;

	
		while( (*vx.rbegin()).f==(*vy.rbegin()).s && (*vx.rbegin()).s==(*vy.rbegin()).f){
			vx.erase(--vx.end());
			vy.erase(--vy.end());
			if(!vx.size() || !vy.size()){
				break;
			}
		}
	//	cout<<"y";
		if(!vx.size() || !vy.size()){
			break;
			
		}
	//	cout<<"z";
		if((*vx.rbegin()).f<=p[i].s.f || (*vy.rbegin()).f<=p[i].s.s  ){
			continue;
		}
		pas=max(pas, p[i].f+(*vx.rbegin()).f+(*vy.rbegin()).f);
	}	
	cout<<pas;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 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 0 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 212 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Incorrect 1 ms 340 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 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 0 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 212 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Incorrect 1 ms 340 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 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 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 79 ms 2040 KB Output is correct
12 Incorrect 52 ms 1364 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 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 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 79 ms 2040 KB Output is correct
12 Incorrect 52 ms 1364 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 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 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 79 ms 2040 KB Output is correct
12 Incorrect 52 ms 1364 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 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 1 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 79 ms 2040 KB Output is correct
12 Incorrect 52 ms 1364 KB Output isn't correct
13 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 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 0 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 212 KB Output is correct
14 Correct 1 ms 340 KB Output is correct
15 Incorrect 1 ms 340 KB Output isn't correct
16 Halted 0 ms 0 KB -