Submission #850508

# Submission time Handle Problem Language Result Execution time Memory
850508 2023-09-16T18:39:19 Z EJIC_B_KEDAX Team Contest (JOI22_team) C++14
0 / 100
1 ms 348 KB
#include <bits/stdc++.h>
#include <random>

#ifndef LOCAL
//    #pragma GCC optimize("O3")
//    #pragma GCC optimize("Ofast")
//    #pragma GCC optimize("unroll-loops")
//    #pragma GCC target("avx,avx2,bmi,bmi2,popcnt,lzcnt")
#endif
using namespace std;
typedef long long ll;
typedef double dd;
typedef long double ld;
typedef unsigned int uii;
#define x first
#define y second
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()



void solve();

mt19937_64 mt(1);

int32_t main() {
#ifdef LOCAL
    freopen("input.in", "r", stdin);
    freopen("output.out", "w", stdout);
#else
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
    //freopen("amusing.in", "r", stdin);
    //freopen("amusing.out", "w", stdout);
#endif
    cout << fixed << setprecision(30);
    int tests = 1;
    //cin >> tests;
    while (tests--) {
        solve();
    }
}

void solve() {
    int n;
    cin >> n;
    set<pair<int, int>> xs, ys, zs;
    vector<int> x(n), y(n), z(n);
    for (int i = 0; i < n; i++) {
        cin >> x[i] >> y[i] >> z[i];
        xs.emplace(-x[i], i);
        ys.emplace(-y[i], i);
        zs.emplace(-z[i], i);
    }
    while (!xs.empty()) {
        pair<int, int> f = *xs.begin(), s = *ys.begin(), t = *zs.begin();
        int i = f.y, j = s.y, l = t.y;
        if (y[i] >= y[j] && z[i] >= z[l]) {
            xs.erase({-x[i], i});
            ys.erase({-y[i], i});
            zs.erase({-z[i], i});
            continue;
        }
        if (x[j] >= x[i] && z[j] >= z[l]) {
            xs.erase({-x[j], j});
            ys.erase({-y[j], j});
            zs.erase({-z[j], j});
            continue;
        }
        if (y[l] >= y[j] && x[l] >= x[i]) {
            xs.erase({-x[l], l});
            ys.erase({-y[l], l});
            zs.erase({-z[l], l});
            continue;
        }
        cout << -(f.x + t.x + s.x) << '\n';
        return;
    }
    cout << "-1\n";
}
# 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 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 -
# 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 -