Pagini recente » Cod sursa (job #1772039) | Arbori Indexati Binar | Cod sursa (job #2279375) | Cod sursa (job #2484449) | Cod sursa (job #1819896)
#include <bits/stdc++.h>
using namespace std;
map <int, int> v;
int readInt()
{
int raspuns = 0;
char c;
while(true)
{
c = getchar_unlocked();
if (c >= '0' && c<='9')
break;
}
raspuns = c-'0';
while (true)
{
c = getchar_unlocked();
if (c<'0' || c>'9')
return raspuns;
raspuns = 10*raspuns + (c-'0');
}
}
int main()
{
freopen ("hashuri.in", "r", stdin);
freopen ("hashuri.out", "w", stdout);
int n, x, op, i;
n = readInt();
for (i = 0; i<n; ++i)
{
op = readInt();
x = readInt();
if (op == 1 && v.count(x) == 0)
v[x] = 1;
if (op == 2 && v.count(x) == 1)
v.erase (x);
if (op == 3)
{
if (v.count(x))
fout << 1 << '\n';
else fout << 0 << '\n';
}
}
return 0;
}