Pagini recente » Cod sursa (job #358516) | Cod sursa (job #2958932) | Cod sursa (job #2647681) | Cod sursa (job #104859) | Cod sursa (job #2974729)
#include <bits/stdc++.h>
using namespace std;
#define MOD 999917
vector<int> has[MOD];
int main(void){
ofstream cout("hashuri.out");
ifstream cin("hashuri.in");
int n;
cin >> n;
for(int i = 1;i<=n;i++){
int c, x;
cin >> c >> x;
if(c == 1){
int caut = x % MOD;
bool adaug = 1;
for(auto y: has[caut]){
if(y == x){
adaug = 0;
break;
}
}
if(adaug)has[caut].push_back(x);
}else if(c == 2){
int caut = x % MOD;
vector<int>::iterator poz = has[caut].end()+1;
for(vector<int>::iterator pz = has[caut].begin(); pz < has[caut].end();pz++){
if(*pz == x){
poz = pz;
break;
}
}
if(poz != has[caut].end()+1){
has[caut].erase(poz);
}
}else{
int caut = x % MOD;
bool gasit =0 ;
for(auto y: has[caut]){
if(y == x){
gasit = 1;
break;
}
}
cout << gasit << '\n';
}
}
}