Pagini recente » Cod sursa (job #943787) | Cod sursa (job #1545985) | Cod sursa (job #1351293) | Cod sursa (job #2487728) | Cod sursa (job #2376795)
#include <bits/stdc++.h>
using namespace std;
const int MAXN =1e6 + 20;
const int MOD = 999917;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
vector <int> hashh[MAXN];
void insertt(int x){
int modulo = x % MOD;
hashh[modulo].push_back(x);
}
void erasee(int x){
int modulo = x % MOD, cnt = 0;
for(auto a : hashh[modulo]){
cnt++;
if(a == x) hashh[modulo].erase(hashh[modulo].begin() + cnt - 1);
}
}
bool findd(int x){
int modulo = x % MOD;
for(auto a : hashh[modulo]){
if(a == x) return true;
}
return false;
}
///hashuri
///cabana
int main(){
ios::sync_with_stdio(false);
fin.tie(0);fout.tie(0);
int n, type, x;
fin >> n;
for(int i = 1; i <= n; ++i){
fin >> type >> x;
if(type == 1) insertt(x);
else if(type == 2) erasee(x);
else fout << findd(x) << '\n';
}
return 0;
}