Pagini recente » Cod sursa (job #914505) | Cod sursa (job #1733723) | Cod sursa (job #929982) | Cod sursa (job #2434350) | Cod sursa (job #2226611)
#include <bits/stdc++.h>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
set <int> hashh [1000000];
int insertt(int x){
int modulo = x % 1000000;
hashh[modulo].insert(x);
}
int erasee(int x){
int modulo = x % 1000000;
hashh[modulo].erase(x);
}
bool findd(int x){
int modulo = x % 1000000;
return hashh[modulo].find(x) != hashh[modulo].end();
}
int main(){
int n;
fin >> n;
for(int i = 1; i <= n; ++i){
int a, b;
fin >> a >> b;
if(a == 1)
insertt(b);
else if(a == 2)
erasee(b);
else {
fout << findd(b) << '\n';
}
}
return 0;
}