# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1096875 | 2024-10-05T10:19:43 Z | thangdz2k7 | Team Contest (JOI22_team) | C++17 | 1 ms | 604 KB |
// author : thembululquaUwU // 3.9.2024 #include <bits/stdc++.h> #define pb push_back #define fi first #define se second #define endl '\n' using namespace std; using ll = long long; using ii = pair <int, int>; using vi = vector <int>; using ar = array <int, 4>; const int N = 2e5 + 5; const int mod = 1e9 + 7; void maxl(auto &a, auto b) {a = max(a, b);} void minl(auto &a, auto b) {a = min(a, b);} vector <ar> V[3]; bool bad[N]; int n; #define fr(i) for (int i = 0; i < 3; ++ i) #define V(x, y) V[x][i[x]][y] void solve(){ cin >> n; int i[] = {n - 1, n - 1, n - 1}; for (int j = 0; j < n; ++ j){ int x, y, z; cin >> x >> y >> z; fr(t) V[t].pb({x, y, z, j}); } fr(t) sort(V[t].begin(), V[t].end(), [&](ar a, ar b) {return a[t] < b[t]; }); while (true){ fr(j) { while (bad[(V(j, 3))]) -- i[j]; if (i[j] < 0){ cout << -1; return; } } ll ans = 0; vi v; fr(j) v.pb(V(j, 3)), ans += V(j, j); bool ok = 0; fr(j) fr(t) if ((j ^ t) && V(j, j) == V(t, j)) bad[v[t]] = 1, ok = 1; if (!ok) { cout << ans << endl; return; } } } int main(){ if (fopen("pqh.inp", "r")){ freopen("pqh.inp", "r", stdin); freopen("pqh.out", "w", stdout); } ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int t = 1; // cin >> t; while (t --) solve(); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Runtime error | 1 ms | 604 KB | Execution killed with signal 11 |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Runtime error | 1 ms | 604 KB | Execution killed with signal 11 |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Runtime error | 1 ms | 348 KB | Execution killed with signal 11 |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Runtime error | 1 ms | 348 KB | Execution killed with signal 11 |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Runtime error | 1 ms | 348 KB | Execution killed with signal 11 |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Runtime error | 1 ms | 348 KB | Execution killed with signal 11 |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Runtime error | 1 ms | 604 KB | Execution killed with signal 11 |
4 | Halted | 0 ms | 0 KB | - |