Pagini recente » Cod sursa (job #2731593) | Cod sursa (job #2027072) | Cod sursa (job #788934) | Cod sursa (job #2434463) | Cod sursa (job #2159472)
#include <iostream>
#include <fstream>
#include <unordered_map>
using namespace std;
ifstream in("hashuri.in");
ofstream out("hashuri.out");
const int BUFSIZE = 7000000;
int ptr;
char buff[BUFSIZE];
int n;
unordered_map<int, int> Map;
void read() {
in.read(buff, BUFSIZE);
ptr = 0;
}
int next_int() {
int x = 0;
while (!isdigit(buff[ptr])) ptr++;
while (isdigit(buff[ptr])) {
x = x * 10 + (buff[ptr] - '0');
ptr++;
if (ptr >= BUFSIZE) read();
}
return x;
}
int main()
{
in.read(buff, BUFSIZE);
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;
}