Pagini recente » Cod sursa (job #3184355) | Cod sursa (job #901816) | Cod sursa (job #457512) | Cod sursa (job #1899305) | Cod sursa (job #2038324)
#include<bits/stdc++.h>
#define M 666013
using namespace std;
ifstream in("hashuri.in");
ofstream out("hashuri.out");
int h(int a){
return a%M;
}
vector <int> ta[M-1];
vector <int>::iterator it;
int main(){
int t, n, i, nr, a;
in >> n;
for (i=1; i<=n; i++){
in >> t >> nr;
a = h(nr);
if (t == 1){
if (find(ta[a].begin(), ta[a].end(), nr) != ta[a].end())
ta[a].push_back(nr);
}
else if (t == 2){
it = find(ta[a].begin(), ta[a].end(), nr);
if (it!=ta[a].end()) ta[a].erase(it);
}
else{
it = find(ta[a].begin(), ta[a].end(), nr);
if (it!=ta[a].end())
out << "1\n";
else
out << "0\n";
}
}
}