Pagini recente » Cod sursa (job #1235789) | Cod sursa (job #103266) | Cod sursa (job #1580884) | Cod sursa (job #1770382) | Cod sursa (job #3140977)
#include <fstream>
#include <vector>
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
int n,i,t,x,ok,h,u,m;
const int N = 524287;
vector<int> a[N],b[N];
int main()
{
f >> n;
for(i = 1; i <= n; i++)
{
f >> t;
if(t==1)
{
f >> x;
m = x&N;
u = -1;
for(h = 0; h < a[m].size(); h++)
if(a[m][h]==x) {u = h; h = n;}
if(u==-1) {a[m].push_back(x); b[m].push_back(1);}
else b[m][u] = 1;
}
else if(t==2)
{
f >> x;
m = x&N;
u = -1;
for(h = 0; h < a[m].size(); h++)
if(a[m][h]==x)
{
u = h;
h = n;
}
if(u >= 0) b[m][u] = 0;
}
else
{
f >> x;
ok = 0;
m = x&N;
u = 0;
for(h = 0; h < a[m].size(); h++)
if(a[m][h]==x) {ok = 1; u = h; h = n;}
if((ok==1)and(b[m][u]==1)) g << "1\n";
else g << "0\n";
}
}
return 0;
}