Pagini recente » Cod sursa (job #2253407) | Cod sursa (job #127541) | Cod sursa (job #3295260) | Cod sursa (job #2846428) | Cod sursa (job #1829784)
#include <iostream>
#include <fstream>
#include<bits/stdc++.h>
#define M 7549
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
long long n;
vector <long long> h[M + 1];
void inserare(long long x)
{
h[x % M].push_back(x);
}
void stergere(long long x)
{
long long i;
for(i = 0; i < h[x % M].size(); ++i){
if(h[x % M][i] == x)
h[x % M][i] = -1;
}
}
int cautare(long long x)
{
long long i;
for(i = 0; i < h[x % M].size(); ++i){
if(h[x % M][i] == x) return 1;
}
return 0;
}
int main()
{
long long i, op, x;
fin>>n;
for(i = 1; i <= n; ++i){
fin>>op>>x;
if(op == 1) inserare(x);
else if(op == 2) stergere(x);
else fout<<cautare(x)<<'\n';
}
return 0;
}