답안 #892310

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
892310 2023-12-25T07:11:50 Z vjudge1 Team Contest (JOI22_team) C++17
0 / 100
1 ms 348 KB
#include <bits/stdc++.h>

using namespace std;

#define int long long
#define pb push_back
#define all(x) x.begin(),x.end()
#define ff first
#define ss second

const long long INF = 1e18;
const int N = 1e5 + 1;

signed main(){
	
	int n;
	cin >> n;
    vector <int> x(n),y(n),z(n);
    vector<pair<int,int>> vx,vy,vz;
    for(int i = 0;i < n;i++){
        cin>>x[i]>>y[i]>>z[i];
        vx.pb({x[i],i});
        vy.pb({y[i],i});
        vz.pb({z[i],i});
    }
    sort(all(vx));
    sort(all(vy));
    sort(all(vz));
    int px = n - 1,py = n - 1,pz = n - 1;
    while(px >= 0 && py >= 0 && pz >= 0){
        auto [nx,p1] = vx[px];
        auto [ny,p2] = vy[py];
        auto [nz,p3] = vz[pz];
        
        if(y[p1] >= ny || z[p1] >= nz){
        	px--;
		} else if(x[p2] >= nx || z[p2] >= nz){
			py--;
		} else if(x[p3] >= nx || y[p3] >= ny){
			pz--;
		} else{
			cout << x[p1] + y[p2] + z[p3] << "\n";
			return 0;
		}
    }
	
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -