Pagini recente » Cod sursa (job #3282652) | Cod sursa (job #1466872) | Cod sursa (job #2002835) | Cod sursa (job #950567) | Cod sursa (job #1771985)
#include <fstream>
#include <vector>
#define M 666013
#define pb push_back
using namespace std;
vector <int> h[M];
vector <int> :: iterator it;
int x, ind,n,op,i;
vector <int> :: iterator Find() {
for (it = h[ind].begin (); it != h[ind].end (); it++)
if (*it == x) return it;
return it;
}
int main () {
freopen("hashuri.in","r",stdin);
freopen("hashuri.out","w",stdout);
scanf("%d",&n);
for (i = 1; i <= n; i++) {
scanf("%d%d",&op,&x);
ind = x % M;
it = Find();
if (op == 1)
if (it == h[ind].end ()) h[ind].pb (x);
if (op == 2)
if (it != h[ind].end ()) h[ind].erase (it);
if (op == 3)
if (it != h[ind].end ()) printf("1\n");
else printf("0\n");
}
return 0;
}