Cod sursa(job #2701400)
Utilizator | Ioana Stroe Ioana_8 | Data | 30 ianuarie 2021 19:54:23 |
---|---|---|---|
Problema | Hashuri | Scor | 70 |
Compilator | cpp-64 | Status | done |
Runda | Arhiva educationala | Marime | 0.73 kb |
#include <fstream>
#include <unordered_map>
using namespace std;
unordered_map <int, bool> m;
int main()
{
ifstream cin("hashuri.in");
ofstream cout("hashuri.out");
int n,op,x;
cin>>n;
for(int i=0;i<n;i++)
{
cin>>op>>x;
if(op==1)
{
if(m[x]==0)
{
m[x]=1;
}
}
else if(op==2)
{
if(m[x]==1)
{
m[x]=0;
}
}
else
{
if(m[x]==0)
{
cout<<"0"<<'\n';
}
else
{
cout<<"1"<<'\n';
}
}
}
return 0;
}