Pagini recente » Cod sursa (job #1312624) | Cod sursa (job #1430533) | Cod sursa (job #1265908) | Cod sursa (job #120333) | Cod sursa (job #1222434)
#include <fstream>
#include <vector>
#define H 101
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
vector<int> h[H];
int n,x,val,cod;
int main()
{
fin>>n;
for(;n;n--)
{
fin>>cod>>val;
x=val%H;
vector<int>::iterator it;
for(it=h[x].begin();it!=h[x].end();it++)
if(*it==val)
break;
if(cod==1)
{
if(it==h[x].end())
h[x].push_back(val);
}
else if(cod==2)
{
if(it!=h[x].end())
{
*it=h[x].back();
h[x].pop_back();
}
}
else
{
if(it==h[x].end())
fout<<"0\n";
else
fout<<"1\n";
}
}
return 0;
}