Submission #892332

# Submission time Handle Problem Language Result Execution time Memory
892332 2023-12-25T08:02:41 Z vjudge1 Sprinkler (JOI22_sprinkler) 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 << nx + ny + nz << "\n";
			return 0;
		}
    }
    cout << "-1\n";
	
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -