Pagini recente » Cod sursa (job #1462136) | Cod sursa (job #2942463) | Cod sursa (job #2830969) | Monitorul de evaluare | Cod sursa (job #2870539)
#include <bits/stdc++.h>
#define FILES freopen("hashuri.in","r",stdin);\
freopen("hashuri.out","w",stdout);
#define fastio ios_base::sync_with_stdio(NULL),cin.tie(NULL),cout.tie(NULL);
#define MAX 100000
#define pb push_back
#define mp make_pair
#define mod 666013
using namespace std;
int n,op,x;
set<int>hs[mod+5];
int main()
{
fastio
FILES
cin >> n;
for(int i = 1;i <= n; ++i)
{
cin >> op >> x;
int r = x % mod;
if(op == 1)
{
auto it = hs[r].lower_bound(x);
if(*it != x)
hs[r].insert(x);
}
else if(op == 2)
{
auto it = hs[r].lower_bound(x);
if(*it == x)
hs[r].erase(it);
}
else
{
auto it = hs[r].lower_bound(x);
if(*it == x) cout << "1\n";
else cout << "0\n";
}
}
}