Pagini recente » Cod sursa (job #1046236) | Cod sursa (job #189691) | Cod sursa (job #2753858) | Cod sursa (job #3153283) | Cod sursa (job #2659560)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
int x,y,t,h;
const int M=700095;
vector <int>v[M];
void adauga()
{
for(auto it:v[h])
if(it==x)return;
v[h].push_back(x);
}
void sterge()
{
for(vector<int>::iterator it=v[h].begin();it!=v[h].end();it++)
if(*it==x){
v[h].erase(it);
return;
}
}
bool querry()
{
for(auto it:v[h])
if(it==x)return 1;
return 0;
}
int main()
{
ios_base::sync_with_stdio(0);
fin.tie(0);
fin>>t;
while(t--)
{
fin>>y>>x;
h=x%M;
if(y==1)adauga();
else if(y==2)sterge();
else fout<<querry()<<'\n';
}
return 0;
}