Pagini recente » Cod sursa (job #437911) | Cod sursa (job #1826989) | Cod sursa (job #2755875) | Cod sursa (job #871002) | Cod sursa (job #1604603)
#include <iostream>
#include <fstream>
#include <map>
#include <string>
#include <sstream>
using namespace std;
ifstream fin ("hashuri.in");
ofstream fout ("hashuri.out");
map <int,int> h;
int n, nr;
inline int to_int(string s)
{
int val;
stringstream iss(s);
iss >> val;
return val;
}
inline void read(int &val)
{
string s;
fin >> s;
val=to_int(s);
}
int main()
{
ios_base::sync_with_stdio(false);
int i, op, x;
read(n);
for(i=1; i<=n; i++)
{
read(op), read(x);
if(op==1 && h.find(x)==h.end()) h[x] = ++nr;
if(op==2) h.erase(x);
if(op==3)
{
if(h.find(x)!=h.end()) fout << "1\n";
else fout << "0\n";
}
}
fin.close();
fout.close();
return 0;
}