Pagini recente » Cod sursa (job #1656555) | Cod sursa (job #2052841) | Cod sursa (job #1509974) | Cod sursa (job #2336925) | Cod sursa (job #1773395)
#include <stdio.h>
#include <unordered_map>
using namespace std;
int n,op,x;
unordered_map<int,int> mp;
const int buff_size=4096;
char buff[buff_size];
int _i=buff_size;
int next_int(FILE * in)
{
char x,y,k=1;
int z=0;
if (_i==buff_size)
y=fread(buff,buff_size,1,in),_i=0;
x=1;
while ((x<48 || x> 57) && x!='-')
{
x=buff[_i];
_i++;
if (_i==buff_size)
{
y=fread(buff,buff_size,1,in);
_i=0;
}
}
while (x>=48 && x<=57 || x=='-')
{
if (x=='-')
k=-1; else
z=(z<<1)+(z<<3)+x-48;
x=buff[_i];
_i++;
if (_i==buff_size)
{
y=fread(buff,buff_size,1,in);
_i=0;
}
}
return z*k;
}
int main(int argc, char const *argv[])
{
freopen("hashuri.in","r",stdin);
freopen("hashuri.out","w",stdout);
n=next_int(stdin);
while (n--)
{
op=next_int(stdin);
x=next_int(stdin);
if (op==1)
mp.insert(make_pair(x,1)); else
if (op==2)
{
if (mp.find(x)!=mp.end() && mp[x]>0)
mp[x]=0;
} else
{
if (mp.find(x)==mp.end() || mp[x]==0)
puts("0"); else
puts("1");
}
}
fclose(stdin);
fclose(stdout);
return 0;
}