Pagini recente » Cod sursa (job #1352718) | Cod sursa (job #998031) | Cod sursa (job #2531544) | Cod sursa (job #1576612) | Cod sursa (job #2663521)
#include <fstream>
#include <iostream>
#include <vector>
using namespace std;
ifstream in("hashuri.in");
ofstream out("hashuri.out");
const int mod = 177;
vector<int>H[mod];
vector<int>::iterator it;
int n;
int exista(int h, int x){
for(it = H[h].begin(); it != H[h].end(); it++)
if(*it == x)
return *it;
return 0;
}
int main(){
in>>n;
for(; n; n--){
int x, c;
in>>c>>x;
int h = x%mod;
int cond = exista(h, x);
if(c == 1){
if(!cond)
H[h].push_back(x);
}
else if(c == 2){
if(cond){
H[h].erase(it);
}
}
else{
if(cond)
cout<<1<<'\n';
else
cout<<0<<'\n';
}
}
}