Pagini recente » Cod sursa (job #2875999) | Cod sursa (job #911522) | Cod sursa (job #215202) | Cod sursa (job #2662600) | Cod sursa (job #2734796)
#include <bits/stdc++.h>
#define mod 700001
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
vector<int>h[mod];
int n;
void op1(int x)
{
unsigned int i;
for(i = 0; i < h[x % mod].size(); ++i)
if(h[x % mod][i] == x)
return;
h[x % mod].push_back(x);
}
void op2(int x)
{
unsigned int i;
for(i = 0; i < h[x % mod].size(); ++i)
if(h[x % mod][i] == x)
{
h[x % mod].erase(h[x % mod].begin() + i);
return;
}
}
void op3(int x)
{
unsigned int i;
for(i = 0; i < h[x % mod].size(); ++i)
if(h[x % mod][i] == x)
{
fout << "1\n";
return;
}
fout << "0\n";
}
int main()
{
int i, op, x;
fin >> n;
for(i = 1; i <= n; ++i)
{
fin >> op >> x;
if(op == 1)
op1(x);
else if(op == 2)
op2(x);
else
op3(x);
}
fin.close();
fout.close();
return 0;
}