Pagini recente » Cod sursa (job #1816815) | Cod sursa (job #2557873) | Cod sursa (job #3196559) | Cod sursa (job #772982) | Cod sursa (job #1997765)
#include <unordered_set>
#include <bits/stdc++.h>
using namespace std;
int N;
unordered_set<int> A;
const int kBuffSize = 655536;
#define fastcall __attribute__((optimize("-O3")))
#define inline __inline__ __attribute__((always_inline))
inline fastcall char getChar()
{
static char buff[kBuffSize];
static int pos = kBuffSize;
if (pos == kBuffSize)
{
fread(buff, 1, kBuffSize, stdin);
pos = 0;
}
return buff[pos++];
}
inline fastcall int readInt()
{
int q = 0;
char c;
do
{
c = getChar();
}
while (!isdigit(c));
do
{
q = (q << 1) + (q << 3) + (c - '0');
c = getChar();
}
while (isdigit(c));
return q;
}
char outBuff[kBuffSize];
int outPtr;
inline fastcall void putChar(const char &C)
{
outBuff[outPtr++] = C;
if (outPtr == kBuffSize)
{
fwrite(outBuff, 1, kBuffSize, stdout);
outPtr = 0;
}
}
inline fastcall void writeInt(int X)
{
char digs[10];
int n = 0, q;
do
{
q = X / 10;
digs[n++] = X - (q << 1) - (q << 3) + '0';
X = q;
}
while (X);
while (n--)
{
putChar(digs[n]);
}
putChar('\n');
}
int main()
{
freopen("hashuri.in", "r", stdin);
freopen("hashuri.out", "w", stdout);
int op, x;
A.reserve(1 << 21);
for (N = readInt(); N; --N)
{
op = readInt();
x = readInt();
if (op == 1)
{
A.insert(x);
continue;
}
if (op == 2)
{
A.erase(x);
continue;
}
writeInt((A.find(x) != A.end()));
}
fclose(stdin);
fwrite(outBuff, 1, outPtr, stdout);
fclose(stdout);
return 0;
}