Pagini recente » Cod sursa (job #1906625) | Cod sursa (job #472432) | Cod sursa (job #693125) | Cod sursa (job #824574) | Cod sursa (job #2376812)
#include <bits/stdc++.h>
using namespace std;
const int MAXN =1e6 + 40;
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) swap(a, hashh[modulo].back()), hashh[modulo].pop_back();
}
}
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;
}