Pagini recente » Cod sursa (job #2190929) | Cod sursa (job #263018) | Borderou de evaluare (job #36700) | Cod sursa (job #1912876) | Cod sursa (job #1691844)
#include <iostream>
#include <fstream>
#include <algorithm>
#include <list>
using namespace std;
#define h 30000
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
list<int> x[h];
int a,b,i,n;
void beszur(int a)
{
x[a%h].push_back(a);
}
void torol(int a)
{
int k = a%h;
list<int>::iterator f = find (x[k].begin(), x[k].end(), a);
if (f != x[k].end()) x[k].erase (f);
}
bool keres(int a)
{
int k = a%h;
list<int>::iterator f = find (x[k].begin(), x[k].end(), a);
if(f != x[k].end()) return 1;
else return 0;
}
int main()
{
fin>>n;
for(i=1;i<=n;i++)
{
fin>>a>>b;
if(a==1) beszur(b);
if(a==2) torol(b);
if(a==3) fout<<keres(b)<<"\n";
}
}