Submission #711288

# Submission time Handle Problem Language Result Execution time Memory
711288 2023-03-16T13:44:30 Z kostia244 Team Contest (JOI22_team) C++17
0 / 100
1 ms 212 KB
#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 xmax = -1, upd = -1;
        for(int j = 0; j < n; j++) if(a[j][2] < a[i][2]) {//y
            if(xmax >= a[j][0]) {
                if(xmax > a[j][0] && upd != a[j][1]) {
                    ans = max(ans, a[i][2] + a[j][1] + xmax);
                }
            } else
                xmax = a[j][0], upd = a[j][1];
        }
        xmax = -1, upd = -1;
        for(int j = n; j--;) if(a[j][2] < a[i][2]) {//y
            // cout << a[i][0] << " " << a[i][1] << " " << a[i][2] << endl;
            // cout << a[j][0] << " " << a[j][1] << " " << a[j][2] << endl;
            // cout << xmax << " " << upd << " " << a[j][0] << " " << a[j][1] << endl;
            if(xmax >= a[j][0]) {
                if(xmax > a[j][0] && upd != a[j][1]) {
                    ans = max(ans, a[i][2] + a[j][1] + xmax);
                }
            } else
                xmax = a[j][0], upd = a[j][1];
        }
    }
    cout << ans << '\n';
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -