Pagini recente » Cod sursa (job #2590754) | Cod sursa (job #2597771) | Cod sursa (job #763366) | Cod sursa (job #1520955) | Cod sursa (job #1756630)
#include <fstream>
#include <map>
using namespace std;
int main()
{
ifstream fin;
ofstream fout;
fout.open("hashuri.out");
fin.open("hashuri.in");
int n, tip, x;
map<int, bool> hashMap;
fin >> n;
for(int i = 1; i <= n; i++)
{
fin >> tip >> x;
switch(tip)
{
case 1 :
if(hashMap.find(x) == hashMap.end())
hashMap[x] = true;
break;
case 2 :
hashMap.erase(x);
break;
case 3 :
if(hashMap.find(x) != hashMap.end())
fout << "1\n";
else
fout << "0\n";
break;
default :
exit(1);
}
}
fin.close();
fout.close();
return 0;
}