Pagini recente » Cod sursa (job #3224824) | Cod sursa (job #3246739) | Cod sursa (job #2214447) | Cod sursa (job #2975239) | Cod sursa (job #2036839)
#include <cstdio>
#include <vector>
#include <algorithm>
using namespace std;
const int R = 666013;
vector<int> v[R + 5];
int h(int x){
return x % R;
}
int main()
{
freopen("hashuri.in", "r", stdin);
freopen("hashuri.out", "w", stdout);
int n, i, a, b, x;
scanf("%d", &n);
for(i = 0;i < n;i++){
scanf("%d%d", &a, &b);
x = h(b);
if(a == 1){
v[x].push_back(b);
}
else
if(a == 2){
vector<int>:: iterator it;
it = find(v[x].begin(), v[x].end(), b);
if(it != v[x].end())
v[x].erase(it);
}
else
if(a == 3){
if(find(v[x].begin(), v[x].end(), b) != v[x].end()){
printf("1\n");
}
else{
printf("0\n");
}
}
}
return 0;
}