Pagini recente » Cod sursa (job #2644328) | Cod sursa (job #275635) | Cod sursa (job #1579474) | Cod sursa (job #3267351) | Cod sursa (job #849332)
Cod sursa(job #849332)
#include <stdio.h>
#include <map>
#include <ext/hash_map>
using namespace std;
using namespace __gnu_cxx ;
/*namespace __gnu_cxx {
template<> struct hash<int>
{ size_t operator()(int __x) const { return __x * r1; } };
}*/
int N, NR;
hash_map <int, int> M;
const int r1 = 666013;
int main()
{
freopen("hashuri.in", "r", stdin);
freopen("hashuri.out", "w", stdout);
int i, tip, x;
scanf("%d ", &N);
for (i = 1; i <= N; i++)
{
scanf("%d %d ", &tip, &x);
if (tip == 1 && M.find(x)==M.end()) M[x] = ++NR;
if (tip == 2) M.erase(x);
if (tip == 3) printf("%d\n", M.find(x) != M.end());
}
return 0;
}