Pagini recente » Cod sursa (job #258946) | Cod sursa (job #329714) | Cod sursa (job #2681768) | Cod sursa (job #455328) | Cod sursa (job #3130417)
#include<iostream>
#include<fstream>
#include<unordered_map>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
int main() {
int n,i,op,nr;
unordered_map<int, int> hash;
fin>>n;
for (i=0; i<n; i++){
fin>>op>>nr;
if (op == 1)
{if (hash.count(nr) == 0)
{hash[nr] = 1;}}
else if (op == 2) {
if (hash.count(nr) == 1)
{hash.erase(nr);}}
else if (op == 3)
{if (hash.count(nr) !=0)
{fout << "1" << endl;}
else
{fout << "0" << endl;}
}
}
fin.close();
fout.close();
}