Pagini recente » Cod sursa (job #3219961) | Cod sursa (job #1177758) | Cod sursa (job #1056231) | Cod sursa (job #1976884) | Cod sursa (job #2626033)
#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;
}
}
return 0;
}