Submission #1096875

#TimeUsernameProblemLanguageResultExecution timeMemory
1096875thangdz2k7Team Contest (JOI22_team)C++17
0 / 100
1 ms604 KiB
// 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 (stderr)

team.cpp:19:11: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   19 | void maxl(auto &a, auto b) {a = max(a, b);}
      |           ^~~~
team.cpp:19:20: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   19 | void maxl(auto &a, auto b) {a = max(a, b);}
      |                    ^~~~
team.cpp:20:11: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   20 | void minl(auto &a, auto b) {a = min(a, b);}
      |           ^~~~
team.cpp:20:20: warning: use of 'auto' in parameter declaration only available with '-fconcepts-ts'
   20 | void minl(auto &a, auto b) {a = min(a, b);}
      |                    ^~~~
team.cpp: In function 'int main()':
team.cpp:55:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   55 |         freopen("pqh.inp", "r", stdin);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
team.cpp:56:16: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   56 |         freopen("pqh.out", "w", stdout);
      |         ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...