Pagini recente » Cod sursa (job #677262) | Cod sursa (job #1682535) | Cod sursa (job #1557930) | Cod sursa (job #1004659) | Cod sursa (job #1502415)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
const int MOD = 666013;
vector < int > Hash[MOD];
inline vector < int > ::iterator Search(const int &x){
vector < int > ::iterator it;
int line = x % MOD;
for(it = Hash[line].begin(); it != Hash[line].end(); it++){
if(*it == x){
return it;
}
}
return Hash[line].end();
}
int main(){
vector < int > ::iterator ans;
int n, type, x;
fin >> n;
while(n--){
fin >> type >> x;
ans = Search(x);
if(type == 1){
if(ans == Hash[x % MOD].end()){
Hash[x % MOD].push_back(x);
}
} else {
if(type == 2){
if(ans != Hash[x % MOD].end()){
Hash[x % MOD].erase(ans);
}
} else {
if(ans == Hash[x % MOD].end()){
fout << "0\n";
} else {
fout << "1\n";
}
}
}
}
return 0;
}