Submission #1086115

#TimeUsernameProblemLanguageResultExecution timeMemory
1086115not_amirMixture (BOI20_mixture)C++17
0 / 100
1 ms604 KiB
#include <bits/stdc++.h> using namespace std; #define pii pair<int, int> #define PI M_PI - 1e-2 int main(){ ios_base::sync_with_stdio(false); cin.tie(NULL); int S, P, G, N; cin >> S >> P >> G >> N; G += S + P; multiset<pii> pts; multiset<double> angles; vector<pair<multiset<pii>::iterator, multiset<double>::iterator>> add; int ctrp = 0, ctrl = 0, ctrt = 0, t = 0; while(N--){ char c; cin >> c; if(c == 'A'){ int x, y, z, divide; cin >> x >> y >> z; z += x + y; x = x * G - S * z; y = y * G - P * z; if(x == 0 && y == 0) ctrp++; else{ divide = gcd(x, y); x?x /= divide:0; y?y /= divide:0; if(pts.find({-x, -y}) != pts.end()) ctrl++; auto it2 = pts.insert({x, y}); auto it = angles.insert(atan2(y, x)); if(it == angles.begin()) if(*angles.rbegin() - *it > PI) ctrt=1; else if(*it - *--it > PI) ctrt=1; if(it == angles.end()) if(*it - *angles.begin() > PI) ctrt=1; else if(*++it - *it > PI) ctrt=1; add.push_back({it2, it}); } } else{ int r, x, y; cin >> r; auto it2 = add[r-1].first; auto it = add[r-1].second; x = (*it2).first; y= (*it2).second; if(x == 0 && y == 0) ctrp--; else{ if(pts.find({-x, -y}) != pts.end()) ctrl--; pts.erase(it2); if(it == angles.begin()) if(*angles.rbegin() - *it > PI) ctrt=0; else if(*it - *--it > PI) ctrt=0; if(it == angles.end()) if(*it - *angles.begin() > PI) ctrt=0; else if(*++it - *it > PI) ctrt=0; angles.erase(it); } } if(ctrp) cout << "1\n"; else if(ctrl) cout << "2\n"; else if(ctrt) cout << "3\n"; else cout << "0\n"; } }

Compilation message (stderr)

Mixture.cpp: In function 'int main()':
Mixture.cpp:33:19: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
   33 |                 if(it == angles.begin())
      |                   ^
Mixture.cpp:37:19: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
   37 |                 if(it == angles.end())
      |                   ^
Mixture.cpp:55:19: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
   55 |                 if(it == angles.begin())
      |                   ^
Mixture.cpp:59:19: warning: suggest explicit braces to avoid ambiguous 'else' [-Wdangling-else]
   59 |                 if(it == angles.end())
      |                   ^
Mixture.cpp:15:39: warning: unused variable 't' [-Wunused-variable]
   15 |     int ctrp = 0, ctrl = 0, ctrt = 0, t = 0;
      |                                       ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...