답안 #602242

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
602242 2022-07-22T18:39:05 Z uncripted Team Contest (JOI22_team) C++11
0 / 100
1 ms 340 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());
		}
	//	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 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Runtime error 0 ms 340 KB Execution killed with signal 11
7 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 Runtime error 0 ms 340 KB Execution killed with signal 11
7 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 336 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Runtime error 1 ms 340 KB Execution killed with signal 11
7 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 336 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Runtime error 1 ms 340 KB Execution killed with signal 11
7 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 336 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Runtime error 1 ms 340 KB Execution killed with signal 11
7 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 336 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Runtime error 1 ms 340 KB Execution killed with signal 11
7 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 Runtime error 0 ms 340 KB Execution killed with signal 11
7 Halted 0 ms 0 KB -