이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define all(x) begin(x), end(x)
using namespace std;
using ll = long long;
int main() {
cin.tie(0)->sync_with_stdio(0);
int n;
cin >> n;
vector<array<int, 3>> a(n);
for(auto &[x, y, z] : a)
cin >> x >> y >> z;
sort(all(a));
a.erase(unique(all(a)), a.end());
n = a.size();
ll ans = -1;
for(int i = 0; i < n; i++) {//z
ll ymax = -1, upd = -1;
for(int j = 0; j < n; j++) if(a[j][2] < a[i][2] && (a[j][0] > a[i][0] || a[j][1] > a[i][1])) {//x
if(ymax >= a[j][1]) {
if(ymax > max(a[j][1], a[i][1]) && upd != a[j][0]) {
// if(a[i][2] + ymax + a[j][0] == 14) {
// cout << a[i][0] << " " << a[i][1] << " " << a[i][2] << endl;
// cout << a[j][0] << " " << a[j][1] << " " << a[j][2] << endl;
// cout << ymax << endl << endl;
// }
ans = max(ans, a[i][2] + ymax + a[j][0]);
}
} else
ymax = a[j][1], upd = a[j][0];
}
}
cout << ans << '\n';
}
# | 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... |