# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1086096 | 2024-09-09T14:31:54 Z | not_amir | Mixture (BOI20_mixture) | C++17 | 0 ms | 348 KB |
#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; set<double> angles; vector<pair<multiset<pii>::iterator, set<double>::iterator>> add; int 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; divide = gcd(x, y); pii v = {x?x / divide:0, y?y / divide:0}; if(pts.find({-v.first, -v.second}) != pts.end()) ctrl++; auto it2 = pts.insert(v); auto it = angles.insert(atan2(v.second, v.first)).first; 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; if(pts.find({-(*it2).first, -(*it2).second}) != 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(pts.find({0, 0}) != pts.end()) cout << "1 "; else if(ctrl) cout << "2 "; else if(ctrt) cout << "3 "; else cout << "0 "; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Incorrect | 0 ms | 348 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |