Pagini recente » Cod sursa (job #445763) | Cod sursa (job #521950) | Cod sursa (job #33272) | Cod sursa (job #369959) | Cod sursa (job #2805908)
#include<fstream>
#include<vector>
#define mod 100007
using namespace std;
ifstream cin("hashuri.in");
ofstream cout("hashuri.out");
vector<vector<int> >mat;
int c,x,n;
int main()
{
mat.resize(mod+1);
cin>>n;
for(int i=1; i<=n; i++)
{
cin>>c>>x;
if(c==1)
{
int ok=0;
for(int j=0; j<mat[x%mod].size(); j++)
if(mat[x%mod][j]*mod==x/mod)
{
ok=1;
break;
}
if(ok==0)
mat[x%mod].push_back(x/mod);
}
else if(c==2)
{
for(int j=0; j<mat[x%mod].size(); j++)
if(mat[x%mod][j]*mod==x/mod)
{
mat[x%mod].erase(mat[x%mod].begin()+j);
break;
}
}
else
{
int ok=0;
for(int j=0; j<mat[x%mod].size(); j++)
if(mat[x%mod][j]*mod==x/mod)
{
ok=1;
break;
}
cout<<ok<<'\n';
}
}
}