Pagini recente » Monitorul de evaluare | Cod sursa (job #2864764) | Cod sursa (job #1510156) | Cod sursa (job #881491) | Cod sursa (job #425714)
Cod sursa(job #425714)
#include <cstdio>
#include <vector>
#include <set>
using namespace std;
#define P 60000
multiset <int> hash[P];
long n, code, x, mod;
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);
mod = x % P;
if (code == 3)
printf("%ld\n", hash[mod].find(x) != hash[mod].end());
else
if (code == 1)
hash[mod].insert(x);
else
if (hash[mod].find(x) != hash[mod].end())
hash[mod].erase(hash[mod].find(x));
}
return 0;
}