Pagini recente » Cod sursa (job #2642387) | Cod sursa (job #1550108) | Cod sursa (job #2308010) | Cod sursa (job #1754795) | Cod sursa (job #1606853)
// Hashing.cpp : Defines the entry point for the console application.
//
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <unordered_map>
#include <map>
#include <fstream>
using namespace std;
int main()
{
ifstream inFile("hashuri.in");
ofstream outFIle("hashuri.out");
map<int, bool> hashMap;
int n, op, val;
inFile >> n;
//cin >> n;
for (int i = 0; i < n; i++) {
inFile >> op >> val;
//cin >> op >> val;
switch (op) {
case 1:
hashMap[val] = true;
break;
case 2:
hashMap[val] = false;
break;
case 3:
if(hashMap[val]){
outFIle << 1 << endl;
//cout << "out" << 1 << endl;
}
else {
outFIle << 0 << endl;
//cout << "out" << 0 << endl;
}
break;
}
}
return 0;
}