Cod sursa(job #425707)
| Utilizator | Data | 25 martie 2010 23:15:50 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 70 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.51 kb |
#include <cstdio>
#include <vector>
#include <set>
using namespace std;
#define P 100007
multiset <int> hash[P];
long n, code, x;
int main()
{
freopen ("hashuri.in", "rt", stdin);
freopen ("hashuri.out", "wt", stdout);
scanf("%ld", &n);
for (long i = 0; i < n; ++i)
{
scanf("%ld %ld", &code, &x);
if (code == 3)
printf("%ld\n", hash[x % P].find(x) != hash[x % P].end());
else
if (code == 1)
hash[x % P].insert(x);
else
hash[x % P].erase(x);
}
return 0;
}
