Submission #255948

# Submission time Handle Problem Language Result Execution time Memory
255948 2020-08-02T06:51:25 Z 최은수(#5029) Mixture (BOI20_mixture) C++17
Compilation error
0 ms 0 KB
#include<iostream>
#include<vector>
#include<set>
#include<map>
#include<algorithm>
#define ep emplace
#define eb emplace_back
#define fi first
#define se second
#define all(x) (x).begin(),(x).end()
using namespace std;
typedef long long ll;
typedef pair<int,int>pi;
typedef pair<ll,ll>pl;
const int inf=1e9+7;
const ll INF=1e18+7;
int zp,zm,zc;
inline bool cmpf(const pl&x,const pl&y)
{
    return x.se*y.fi<y.se*x.fi;
}
struct cmp
{
    inline bool operator()(const pl&x,const pl&y)const
    {
        return x.se*y.fi<y.se*x.fi;
    }
};
multiset<pl,cmp>pls,mins;
map<pl,int>pc,mc;
ll cmt;
pl bot[100010];
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
    ll aa,bb,cc;
    cin>>aa>>bb>>cc;
    int tc;
    cin>>tc;
    int bct=0;
    for(int ti=0;ti<tc;ti++)
    {
        char tp;
        cin>>tp;
        if(tp=='A')
        {
            int id=++bct;
            ll a,b,c;
            cin>>a>>b>>c;
            ll x=b*aa-bb*a;
            ll y=c*aa-cc*a;
            if(x!=0||y!=0)
            {
                ll g=abs(__gcdll(x,y));
                x/=g;
                y/=g;
            }
            bot[id]=pl(x,y);
            if(x==0)
            {
                if(y==0)
                    zc++;
                else
                    (y==1?zp:zm)++;
            }
            else if(x>0)
            {
                cmt+=mc[pl(x,y)];
                pc[pl(x,y)]++;
                pls.ep(x,y);
            }
            else
            {
                cmt+=pc[pl(-x,-y)];
                mc[pl(-x,-y)]++;
                mins.ep(-x,-y);
            }
        }
        else
        {
            int id;
            cin>>id;
            ll x=bot[id].fi;
            ll y=bot[id].se;
            if(x==0)
            {
                if(y==0)
                    zc--;
                else
                    (y==1?zp:zm)--;
            }
            else if(x>0)
            {
                pls.erase(pls.find(pl(x,y)));
                pc[pl(x,y)]--;
                cmt-=mc[pl(x,y)];
            }
            else
            {
                mins.erase(mins.find(pl(-x,-y)));
                mc[pl(-x,-y)]--;
                cmt-=pc[pl(-x,-y)];
            }
        }
        if(zc>0)
            cout<<"1\n";
        else if((zp>0&&zm>0)||cmt>0)
            cout<<"2\n";
        else if(pls.empty()||mins.empty())
            cout<<"0\n";
        else
        {
            bool f1=cmpf(*pls.begin(),*mins.rbegin())||zm>0;
            bool f2=cmpf(*mins.begin(),*pls.rbegin())||zp>0;
            if(f1&&f2)
                cout<<"3\n";
            else
                cout<<"0\n";
        }
    }
    cout.flush();
    return 0;
}

Compilation message

Mixture.cpp: In function 'int main()':
Mixture.cpp:55:26: error: '__gcdll' was not declared in this scope
                 ll g=abs(__gcdll(x,y));
                          ^~~~~~~
Mixture.cpp:55:26: note: suggested alternative: '__gid_t'
                 ll g=abs(__gcdll(x,y));
                          ^~~~~~~
                          __gid_t