Cod sursa(job #1686330)
Utilizator | Data | 12 aprilie 2016 10:44:49 | |
---|---|---|---|
Problema | Hashuri | Scor | 20 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.42 kb |
#include <iostream>
#include <fstream>
#include <map>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
map<int,int> h;
int n,t,x,i;
int main()
{
fin>>n;
for(i=1;i<=n;i++)
{
fin>>t>>x;
if(t==1&&h.find(x)==h.end()) h[x]=1;
else if(t==2) h.erase(x);
else if(h.find(x)==h.end()) fout<<"0\n";
else fout<<"1\n";
}
return 0;
}