Pagini recente » Cod sursa (job #1285262) | Cod sursa (job #1187424) | Profil Stavarache.Antonio | Cod sursa (job #223066) | Cod sursa (job #580149)
Cod sursa(job #580149)
#include<fstream>
#include<algorithm>
#include<set>
#define MOD 33500
using namespace std;
int N,x,y;
set<int> g[MOD];
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
int hash(int x)
{
return x%MOD;
}
int main()
{
fin>>N;
for(int i=1;i<=N;++i)
{
fin>>x>>y;
if(x==1)
{
g[hash(y)].insert(y);
}
if(x==2)
{
g[hash(y)].erase(y);
}
if(x==3)
{
if(g[hash(y)].find(y)!=g[hash(y)].end())
fout<<"1\n";
else fout <<"0\n";
}
}
}