Pagini recente » Cod sursa (job #2343551) | Cod sursa (job #1281558) | Cod sursa (job #1428269) | Cod sursa (job #1171935) | Cod sursa (job #3129012)
#include <iostream>
#include <unordered_map>
#include <fstream>
using namespace std;
int main()
{
ifstream f("hashuri.in");
ofstream g("hashuri.out");
int n, a, b;
unordered_map<int,int>hashtabel;
f>>n;
for(int i=0;i<n;i++)
{
f>>a>>b;
if (a==1 and hashtabel.count(b)==0)
{
hashtabel[b]=1;
}
else if(a==2 and hashtabel.count(b)==1)
{
hashtabel.erase(b);
}
else if(a==3 and hashtabel.count(b)==1)
{
g<<1<<endl;
}
else if(a==3 and hashtabel.count(b)==0)
{
g<<0<<endl;
}
}
f.close();
g.close();
return 0;
}