Pagini recente » Cod sursa (job #2697475) | Cod sursa (job #237735) | Cod sursa (job #2067096) | Cod sursa (job #59294) | Cod sursa (job #2734783)
#include <bits/stdc++.h>
#define mod 700001
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
vector<int> h[mod];
int n;
int main()
{
int i, j, op, x, da;
fin >> n;
for(i = 1; i <= n; i++)
{
fin >> op;
fin >> x;
if(op == 1)
h[x % mod].push_back(x);
if (op == 2)
{
da = 0;
for(j = 0; j < h[x % mod].size(); j++)
if(x == h[x][j])
{
da = 1;
break;
}
if(da == 1)
{
swap(h[x][j], h[x][h[x].size() - 1]);
h[x].pop_back();
}
}
if(op == 3)
{
da = 0;
for(j = 0; j < h[x % mod].size(); j++)
if(x == h[x][j])
{
da = 1;
break;
}
if(da == 1)
fout << "1\n";
else fout << "0\n";
}
}
return 0;
}