Pagini recente » Cod sursa (job #2557375) | Cod sursa (job #2810145) | Cod sursa (job #1550784) | Cod sursa (job #147151) | Cod sursa (job #2474785)
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
const int mod= 1000000;
vector <int> v[1000000];
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;
}