Submission #974423

# Submission time Handle Problem Language Result Execution time Memory
974423 2024-05-03T10:17:18 Z kl0989e Mixture (BOI20_mixture) C++17
13 / 100
1 ms 600 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define fi first
#define se second
#define pb push_back
#define vi vector<int>
#define pi pair<int, int>
#define all(x) (x).begin(),(x).end()

const long double PI=acos(-1);

struct cmp{
	bool operator()(const long double& a,const long double& b)const{
		return a+1e-15<b;
	}
};

int main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int X,Y,Z;
    cin >> X >> Y >> Z;
    long double yy=1.0*Y/(X+Y+Z),xx=1.0*X/(X+Y+Z);
    int cnt1=0,cnt2=0;
    int n;
    cin >> n;
    vector<vi> points;
    multiset<long double,cmp> angles;
    char c;
    int x,y,z;
    for (int i=0; i<n; i++) {
        cin >> c;
        if (c=='A') {
            cin >> x >> y >> z;
            points.pb({x,y,z});
            if (1ll*X*(x+y+z)==1ll*x*(X+Y+Z) && 1ll*Y*(x+y+z)==1ll*y*(X+Y+Z)) {
                cnt1++;
            }
            long double ang=atan2(1.0*y/(x+y+z)-yy,1.0*x/(x+y+z)-xx);
            //cout << "ang: " << i << ' ' << ang << ' ' << (1.0*y/(x+y+z))-yy << ' ' << (1.0*x/(x+y+z))-xx << '\n';
            //cout << 1.0*y/(x+y+z) << ' ' << 1.0*x/(x+y+z) << ' ' << yy << ' ' << xx << '\n';
            angles.emplace(ang);
            if (ang>0) {
                ang-=PI;
            }
            else {
                ang+=PI;
            }
            cnt2+=angles.count(ang);
            //cout << "CNT: " << angles.count(ang) << ' ' << cnt2 << ' ' << ang << '\n';
        }
        else {
            cin >> x;
            y=points[--x][1];
            z=points[x][2];
            x=points[x][0];
            if (1ll*X*(x+y+z)==1ll*x*(X+Y+Z) && 1ll*Y*(x+y+z)==1ll*y*(X+Y+Z)) {
                cnt1--;
            }
            long double ang=atan2(1.0*y/(x+y+z)-yy,1.0*x/(x+y+z)-xx);
            angles.extract(ang);
            if (ang>0) {
                ang-=PI;
            }
            else {
                ang+=PI;
            }
            cnt2-=angles.count(ang);
        }
        if (cnt1) {
            cout << "1\n";
        }
        else if (cnt2) {
            cout << "2\n";
        }
        else {
            bool ok=1;
            if (angles.size()<3) {
                ok=0;
            }
            else if ((*angles.rbegin()-*angles.begin())<PI) {
                ok=0;
            }
            else {
                auto it=angles.lower_bound(0);
                if (it==angles.begin()) {
                    ok=0;
                }
                else if ((*it-*prev(it)>PI)) {
                    ok=0;
                }
                else if (it!=--angles.end() && *next(it)-*it>PI) {
                    ok=0;
                }
                else if (it==--angles.end() && *it<1e-15) {
                    ok=0;
                }
            }
            if (ok) {
                cout << "3\n";
            }
            else {
                cout << "0\n";
            }
        }
        /*cout << "I: " << i << ' ';
        for (auto it=angles.begin(); it!=angles.end(); it++) {
            cout << *it << ' ';
        }
        cout << '\n';
        cout << "cnt: " << cnt2 << '\n';*/
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 600 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 600 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Incorrect 0 ms 348 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 600 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Incorrect 0 ms 348 KB Output isn't correct
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 600 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 344 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 344 KB Output is correct
21 Incorrect 0 ms 348 KB Output isn't correct
22 Halted 0 ms 0 KB -