Pagini recente » Cod sursa (job #1211937) | Cod sursa (job #947266) | Cod sursa (job #3222093) | Cod sursa (job #2363152) | Cod sursa (job #2159450)
#include <iostream>
#include <fstream>
#include <unordered_map>
using namespace std;
ifstream in("hashuri.in");
ofstream out("hashuri.out");
int ptr;
char buff[5000002];
int n;
unordered_map<int, int> Map;
int next_int() {
int x = 0;
while (!isdigit(buff[ptr])) ptr++;
while (isdigit(buff[ptr])) {
x = x * 10 + (buff[ptr] - '0');
ptr++;
}
return x;
}
int main()
{
in.read(buff, 5000000);
n = next_int();
for (int i = 1, o, x; i <= n; ++i) {
o = next_int();
x = next_int();
if (o == 1) {
Map[x] = 1;
} else if (o == 2) {
Map[x] = 0;
} else if (o == 3) {
if (Map[x]) out << 1; else out << 0;
out << "\n";
}
}
return 0;
}