답안 #794992

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
794992 2023-07-27T04:59:24 Z vjudge1 Team Contest (JOI22_team) C++17
0 / 100
1 ms 212 KB
#include<bits/stdc++.h>

using namespace std;

struct person {
    int x, y, z;
};

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0), cout.tie(0);
    int n;
    cin >> n;
    vector<person> a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i].x >> a[i].y >> a[i].z;
    }
    sort(a.begin(), a.end(), [](person l, person r) {return l.z < r.z;});
    int ans = 0;

    for(int i = 0; i < n; i++) {
        cout << a[i].x << ' ' << a[i].y << ' ' << a[i].z << '\n';
        int Y = 0, l = i + 1;
        for(int j = i + 1; j < n; j++) {
            if(a[j].x >= a[i].x || a[j].z == a[i].z) continue;
            while (a[l].z < a[j].z) {
                if(a[l].x < a[i].x) Y = max(Y, a[l].y);
                l++;
            }

            if(Y > max(a[i].y, a[j].y)) {
                ans = max(ans, a[i].x + Y + a[j].z);
            }
        }
        int X = 0, r = i + 1;
        for(int j = i + 1; j < n; j++) {
            if(a[j].y >= a[i].y || a[j].z == a[i].z) continue;
            while (a[r].z < a[j].z) {
                if(a[r].y < a[i].y) X = max(X, a[r].x);
                r++;
            }

            if(X > max(a[i].x, a[j].x)) {
                ans = max(ans, a[i].y + X + a[j].z);
            }
        }

    }
    if(ans == 0) ans = -1;
    cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -