Pagini recente » Cod sursa (job #576122) | Cod sursa (job #3239411) | Cod sursa (job #3231582) | Cod sursa (job #380201) | Cod sursa (job #432168)
Cod sursa(job #432168)
#include <cstdio>
#include <vector>
#define q 4000001
using namespace std;
int n;
bool hash[q];
void push(int x)
{
hash[x%q]=1;
}
void pop(int x)
{
hash[x%q]=0;
}
void query(int x)
{
printf("%d\n",hash[x%q]);
}
int main()
{
freopen ("hashuri.in","r",stdin);
freopen ("hashuri.out","w",stdout);
scanf("%d",&n);
int x,y;
while (n--)
{
scanf("%d%d",&y,&x);
if (y==1)
push(x);
if (y==2)
pop(x);
if (y==3)
query(x);
}
return 0;
}