Pagini recente » Cod sursa (job #1118720) | Cod sursa (job #756185) | Cod sursa (job #1992464) | Cod sursa (job #1692293) | Cod sursa (job #2474783)
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
const int mod= 14000000;
vector <int> v[14000000];
void adaugare(int x)
{
int poz=x % mod;
for(int i=0;i<v[poz].size();i++)
if(v[poz][i]==x)
{
return;
}
v[poz].push_back(x);
}
void stergere(int x)
{
int poz= x % mod;
for(int i=0;i<v[poz].size();i++)
if(v[poz][i]==x)
{
v[poz].erase(v[poz].begin()+i);
}
}
bool gasire(int x)
{
int poz= x % mod;
for(int i=0;i<v[poz].size();i++)
if(v[poz][i]==x)
return true;
return false;
}
int main()
{
int n,i,x,c;
fin>>n;
for(i=1;i<=n;i++)
{
fin>>c>>x;
if(c==1)
{
adaugare(x);
}
if(c==2)
stergere(x);
if(c==3)
fout<<gasire(x)<<"\n";
}
return 0;
}