Pagini recente » Cod sursa (job #2445502) | Cod sursa (job #1934400) | Cod sursa (job #887097) | Cod sursa (job #2328680) | Cod sursa (job #1685141)
#include <stdio.h>
#include <vector>
#include <unordered_map>
#define w 200017
using namespace std;
int n,i,op,x,r;
unordered_map<int,bool> H;
int find(int x)
{
return H.count(x);
}
void insert(int x)
{
if (!find(x)) H[x]=1;
}
void remove(int x)
{
if (find(x)) H.erase(x);
}
int main()
{
freopen ("hashuri.in","r",stdin);
freopen ("hashuri.out","w",stdout);
scanf("%i",&n);
while (n--)
{
scanf("%i%i",&op,&x);
r=x%w;
switch (op)
{
case 1:
insert(x);
break;
case 2:
remove(x);
break;
case 3:
printf("%i\n",find(x));
break;
}
}
fclose(stdin);
fclose(stdout);
return 0;
}