This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<ll> vii;
typedef pair<ll,ll> pii;
#define F first
#define S second
#define pb push_back
#define all(v) v.begin(),v.end()
#define pow poww
const ll M=1e5+10;
const ll inf=2e18;
const ll mod=1e9+7;
ll pow(ll x,ll y){
ll res=1;
x%=mod;
while(y>0){
if((y&1))
res*=x,res%=mod;
x*=x,x%=mod;
y=(y>>1);
}
return res;
}
ll n,chk[2][2],cc[M][2],cchk[3][3],t=1,aa=0;
int main(){
ios_base::sync_with_stdio(0),cin.tie(0);
ll TC=1;
//cin>>TC;
while(TC--){
ll x,y,z;
cin>>x>>y>>z;
cin>>n;
for(int i=0;i<n;i++){
char c;
cin>>c;
if(c=='R'){
ll ind;
cin>>ind;
if(cc[ind][0]>-1&&cc[ind][1]>-1)
chk[cc[ind][0]][cc[ind][1]]--;
if(cc[ind][0]==-1&&cc[ind][1]==0)
cchk[0][1]--;
else if(cc[ind][0]==-1&&cc[ind][1]==1)
cchk[0][2]--;
else if(cc[ind][1]==-1&&cc[ind][0]==0)
cchk[1][0]--;
else if(cc[ind][1]==-1&&cc[ind][0]==1)
cchk[2][0]--;
if(cc[ind][0]==cc[ind][1]&&cc[ind][0]==-1)
aa--;
}
else{
ll a,b,c;
cin>>a>>b>>c;
a*=x*y*z,b*=x*y*z,c*=x*y*z;
a/=x,b/=y,c/=z;
if(a>b)
cc[t][0]=1;
else if(a<b)
cc[t][0]=0;
else
cc[t][0]=-1;
if(a>c)
cc[t][1]=1;
else if(a<c)
cc[t][1]=0;
else
cc[t][1]=-1;
if(cc[t][0]>-1&&cc[t][1]>-1)
chk[cc[t][0]][cc[t][1]]=1;
if(x==y&&x>z)
cchk[0][1]=1;
else if(x==y&&x<z)
cchk[0][2]=1;
if(x==z&&x>y)
cchk[0][1]=1;
else if(x==z&&x<y)
cchk[0][2]=1;
t++;
if(a==b&&b==c)
aa++;
}
bool ans=0;
for(int i=0;i<2;i++){
for(int j=0;j<2;j++){
if(chk[i][j]>0&&chk[1-i][1-j]>0)
ans=1;
}
}
for(int i=1;i<3;i++){
if(cchk[0][i]&&cchk[0][3-i])
ans=1;
if(cchk[i][0]&&cchk[3-i][0])
ans=1;
}
if(aa>0){
cout<<1<<'\n';
}
else if(ans)
cout<<2<<'\n';
else
cout<<0<<'\n';
}
}
return 0;
}
/*
*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |