Pagini recente » Cod sursa (job #2320245) | Cod sursa (job #246133) | Cod sursa (job #1671235) | Cod sursa (job #417575) | Cod sursa (job #779282)
Cod sursa(job #779282)
#include <cstdio>
#include <cstdlib>
#include <vector>
#include <algorithm>
using namespace std;
vector<int> hash[3000];
int N, A, B;
int main()
{
freopen("hashuri.in", "r", stdin);
freopen("hashuri.out", "w", stdout);
int i;
scanf("%i", &N);
for(; N; N --)
{
scanf("%i %i", &A, &B);
if(A == 1)
if(find(hash[B % 3000].begin(), hash[B % 3000].end(), B) == hash[B % 3000].end())
hash[B % 3000].push_back(B);
if(A == 2)
if(find(hash[B % 3000].begin(), hash[B % 3000].end(), B) != hash[B % 3000].end())
hash[B % 3000].erase(find(hash[B % 3000].begin(), hash[B % 3000].end(), B));
if(A == 3)
if(find(hash[B % 3000].begin(), hash[B % 3000].end(), B) != hash[B % 3000].end())
printf("1\n");
else printf("0\n");
}
scanf("%i", &i);
return 0;
}