Pagini recente » Cod sursa (job #1000036) | Cod sursa (job #2518038) | Cod sursa (job #2682265) | Cod sursa (job #2527359) | Cod sursa (job #2817219)
#include <bits/stdc++.h>
using namespace std;
const int MOD = 666013;
vector <int> h[MOD];
int main()
{
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
int n,cer,x,y;
vector<int>::iterator it;
fin >> n;
for (int i = 0;i < n;i++ ){
fin >> cer >> x;
y = x % MOD;
if (cer == 1) {
if (find(h[y].begin(), h[y].end(), x) == h[y].end())
h[y].push_back(x);
}
else if (cer == 2) {
it = find(h[y].begin(), h[y].end(), x);
if (it != h[y].end())
h[y].erase(it);
}
else {
if (find(h[y].begin(), h[y].end(), x) == h[y].end())
fout << 0 << '\n';
else
fout << 1 << '\n';
}
}
return 0;
}