Pagini recente » Cod sursa (job #725966) | Cod sursa (job #573080) | Cod sursa (job #1861753) | Cod sursa (job #1263868) | Cod sursa (job #1606840)
// Hashing.cpp : Defines the entry point for the console application.
//
#include <iostream>
#include <stdlib.h>
#include <algorithm>
#include <unordered_map>
#include <fstream>
using namespace std;
int main()
{
ifstream inFile("hashuri.in");
ofstream outFIle("hashuri.out");
unordered_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;
}
}
outFIle.close();
return 0;
}