# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
544850 | Ronin13 | Team Contest (JOI22_team) | C++14 | 126 ms | 6364 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<iostream>
#include <math.h>
#include <queue>
#define ll long long
#define f first
#define s second
#define pii pair<int, int>
#define pll pair<ll,ll>
#define pb push_back
#define epb emplace_back
#define ull unsigned ll
#pragma optimization("unroll-loops")
#pragma optimize("Ofast")
#pragma optimize("3")
#pragma target("avx2,avx,fma")
using namespace std;
int main(){
ios_base::sync_with_stdio(false);cin.tie(0);
int n; cin >> n;
int x[n + 1];
int y[n + 1];
int z[n + 1];
for(int i = 1; i <= n; i++){
cin >> x[i] >> y[i] >> z[i];
}
int ans = -1;
priority_queue <pii> px, py, pz;
for(int i = 1; i <= n; i++){
px.push({x[i], i});
py.push({y[i], i});
pz.push({z[i], i});
}
while(!px.empty()){
int i = px.top().s;
px.pop();
while(!py.empty()){
int j = py.top().s;
if(x[j] >= x[i]){
py.pop();
continue;
}
if(y[i] >= y[j])break;
bool indd = false;
while(!pz.empty()){
int k = pz.top().s;
if(x[k] >= x[i] || y[k] >= y[j]){pz.pop();continue;}
if(z[j] >= z[k]){
indd = true;
break;
}
if(z[i] >= z[k])break;
cout << z[k] + x[i] + y[j];
return 0;
}
if(indd)py.pop();
else break;
}
}
cout << -1;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |