Pagini recente » Cod sursa (job #635198) | Cod sursa (job #2483659) | Cod sursa (job #1177022) | Cod sursa (job #400801) | Cod sursa (job #1429623)
#include <iostream>
#include<fstream>
#include <vector>
#define Key 666013
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
vector <int> G[Key];
int Find(int x)
{
int List=x%Key;
for(unsigned int i=0;i<G[List].size();i++)
if(G[List][i]==x) return i;
return -1;
}
int Insert(int x)
{
int List=x%Key;
int poz=Find(x);
if(poz==-1)
G[List].push_back(x);
}
void Delete(int x)
{
int List=x%Key;
int poz=Find(x);
if(poz!=-1)
G[List].erase(G[List].begin()+poz);
}
int main()
{
int n;
fin>>n;
int i,op,x;
for(i=1;i<=n;i++)
{
fin>>op>>x;
if(op==1) Insert(x);
else
if(op==2) Delete(x);
else if(Find(x)==-1) fout<<0<<"\n";
else fout<<1<<"\n ";
}
return 0;
}