Pagini recente » Cod sursa (job #171518) | Cod sursa (job #1300628) | Cod sursa (job #3163006) | Cod sursa (job #1686517) | Cod sursa (job #3213488)
#include <bits/stdc++.h>
#define ll long long
//#define fin cin
//#define fout cout
using namespace std;
const int MOD=99991;
ifstream fin ("hashuri.in");
ofstream fout ("hashuri.out");
vector< list<int> > hash_list (100005);
//bool ciur[100005];
int main()
{
fin.tie(0); fin.sync_with_stdio(false);
/*
int biggest_prim=0;
for (int i=2; i*i<=100000; i++) {
if (ciur[i]==0) {
for (int j=i*i; j<=100000; j+=i) {
ciur[j]=1;
}
}
}
for (int j=100000; j>=0; j--) {
if (ciur[j]==0) {
biggest_prim=j;
break;
}
}
cout<<biggest_prim<<endl;
*/ //Pentru a gasi valoarea lui MOD;
int n, a, b; fin>>n;
for (int i=1; i<=n; i++) {
fin>>a>>b;
int index=b%MOD;
bool in_list=false;
auto it=find(hash_list[index].begin(), hash_list[index].end(), b);
if (a==1) {
if (it==hash_list[index].end()) {
hash_list[index].insert(it, b);
}
}
if (a==2) {
if (it!=hash_list[index].end()) {
hash_list[index].erase(it);
}
}
if (a==3) {
bool ans=it!=hash_list[index].end();
fout<<ans<<'\n';
}
}
return 0;
}