Pagini recente » Cod sursa (job #1125073) | Cod sursa (job #2604703) | Cod sursa (job #3031255) | Cod sursa (job #301783) | Cod sursa (job #2626020)
#include <fstream>
#include <unordered_map>
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
unordered_map<int,int> hashmap;
unordered_map<int,int>::iterator x;
int main()
{
int a, b, n;
f >> n;
for (unsigned i = 0; i < n; ++i)
{
f >> a>>b;
switch (a)
{
case 1:
hashmap.insert(make_pair(b, 1));
break;
case 2:
x=hashmap.find(b);
if (x != hashmap.end())
hashmap.erase(b);
break;
case 3:
x=hashmap.find(b);
if (x != hashmap.end())
g << 1 << endl;
else
g << 0 << endl;
break;
default:
break;
}
}
f.close();
g.close();
return 0;
}