#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define pll pair<ll,ll>
#define pii pair<int,int>
#define fs first
#define sc second
#define tlll tuple<ll,ll,ll>
struct point{
ll x,y,z;
point(){x = y = z = 0;}
point(int a,int b,int c){x = a,y = b,z = c;}
point operator+(point b)const{return point(x+b.x,y+b.y,z+b.z);}
point operator-(point b)const{return point(x-b.x,y-b.y,z-b.z);}
ll operator*(point b)const{return x*b.x+y*b.y+z*b.z;}
point operator^(point b)const{return point(y*b.z-z*b.y,z*b.x-x*b.z,x*b.y-y*b.x);}
bool operator<(point b)const{return x== b.x?y == b.y?z<b.z:y<b.y:x<b.x;}
bool operator==(point b)const{return x==b.x&&y==b.y&&z==b.z;}
bool operator!=(point b)const{return !((*this) == b);}
};
const int mxn = 1e5+10;
ll Q;
point arr[mxn];
int pt = 0;
point tar;
int nowans;
ll one,two;
map<point,ll> mp,normal;
inline point trans(point tmp){
ll G = 0;
if(tmp.x)G = (G?__gcd(G,abs(tmp.x)):abs(tmp.x));
if(tmp.y)G = (G?__gcd(G,abs(tmp.y)):abs(tmp.y));
if(tmp.z)G = (G?__gcd(G,abs(tmp.z)):abs(tmp.z));
tmp.x/=G,tmp.y/=G,tmp.z/=G;
return tmp;
}
inline void add(point now){
mp[now]++;
if(now == tar){
one++;
return;
}
auto tmp = (now^tar);
tmp = trans(tmp);
normal[tmp]++;
two += normal[point()-tmp];
return;
}
inline void del(point now){
assert(mp.find(now) != mp.end());
if(now == tar){
one--;
mp[now]--;
return;
}
auto tmp = (now^tar);
tmp = trans(tmp);
two -= normal[point()-tmp];
normal[tmp] --;
mp[now]--;
if(!mp[now])mp.erase(now);
return;
}
inline int getans(){
assert(one>=0&&two>=0);
if(one)return 1;
else if(two)return 2;
else if(normal.size()>1&&mp.size()>2)return 3;
else return 0;
}
int main(){
ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
cin>>tar.x>>tar.y>>tar.z;
tar = trans(tar);
cin>>Q;
while(Q--){
char tp;
cin>>tp;
if(tp == 'A'){
pt++;
cin>>arr[pt].x>>arr[pt].y>>arr[pt].z;
arr[pt] = trans(arr[pt]);
add(arr[pt]);
}
else{
int id;
cin>>id;
del(arr[id]);
}
cout<<getans()<<'\n';
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2648 KB |
Output is correct |
2 |
Incorrect |
2 ms |
2648 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2648 KB |
Output is correct |
2 |
Incorrect |
2 ms |
2648 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2648 KB |
Output is correct |
2 |
Incorrect |
2 ms |
2648 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
2648 KB |
Output is correct |
2 |
Incorrect |
2 ms |
2648 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |