Pagini recente » Cod sursa (job #2269869) | Statisticile problemei Parantezare | Cod sursa (job #223417) | Profil sebinechita | Cod sursa (job #2197844)
#include <iostream>
#include <fstream>
#include <vector>
#define numar 75433
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
vector<int> hs[numar];
int gaseste(int x){
int r=x%numar;
for(int i=0;i<hs[r].size();i++)
if(hs[r][i]==x)
return i;
return -1;
}
int insereaza(int x){
int r=x%numar;
int num=gaseste(x);
if(num==-1)
{
hs[r].push_back(x);
}
}
void sterge(int x)
{
int r=x%numar;
int num=gaseste(x);
if(num!=-1)
{
hs[r].erase(hs[r].begin()+num);
}
}
int main()
{
int n;
f>>n;
for(int i=1;i<=n;i++)
{
int x,y;
f>>x>>y;
if(x==1)
insereaza(y);
else if(x==2)
sterge(y);
else {
int p;
p=gaseste(y);
if(p!=-1)
g<<1<<'\n';
else g<<0<<'\n';
}
}
}