Submission #962883

# Submission time Handle Problem Language Result Execution time Memory
962883 2024-04-14T09:19:17 Z marinaluca Team Contest (JOI22_team) C++14
0 / 100
1 ms 4444 KB
#include <bits/stdc++.h>
//#include <ext/pb_ds/assoc_container.hpp>

#pragma GCC optimize ("O4")
#pragma GCC optimize ("fast-math")
#pragma GCC optimize ("unroll-loops")

using namespace std;
#define int long long
#define ll long long
#define XX first
#define YY second
#define pb push_back
#define sz (x) int(x.size())
#define pf pop_front
#define pob pop_back
#define pff push_front

const int NMAX = 200100;
set <pair <int, int>> xx, yy, zz;
int x[NMAX + 1], y[NMAX + 1], z[NMAX + 1];

signed main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    int n, sum = -1;
    cin >> n;
    for (int i = 1; i <= n; ++ i){
        cin >> x[i] >> y[i] >> z[i];
        xx.insert ({x[i], i});
        yy.insert ({y[i], i});
        zz.insert ({z[i], i});
    }
    while (!xx.empty() && !yy.empty() && !zz.empty()){
        int x1 = xx.rbegin() -> second;
        int y1 = yy.rbegin() -> second;
        int z1 = zz.rbegin() -> second;
        if (y[x1] >= y[y1] || z[x1] >= z[z1]){
            xx.erase({x[x1], x1});
            yy.erase({y[x1], x1});
            zz.erase({z[x1], x1});
            continue;
        }
        if (x[y1] >= x[x1] || z[y1] >= z[z1]){
            xx.erase({x[y1], y1});
            yy.erase({y[y1], y1});
            zz.erase({z[y1], y1});
            continue;
        }
        if (x[z1] >= x[x1] || y[z1] >= y[y1]){
            xx.erase({x[z1], z1});
            yy.erase({y[z1], z1});
            zz.erase({z[z1], z1});
            continue;
        }
        sum = x[x1] + y[y1] + z[x1];
        break;
    }
    cout << sum;
    return 0 ^ 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4444 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 4444 KB Output isn't correct
2 Halted 0 ms 0 KB -