Pagini recente » Cod sursa (job #2528616) | Cod sursa (job #2644030) | Cod sursa (job #108890) | Cod sursa (job #2502116) | Cod sursa (job #2625043)
#include <fstream>
#include <iostream>
#include <vector>
#include <algorithm>
#define P 35281
using namespace std;
ifstream in ("hashuri.in");
ofstream out ("hashuri.out");
vector<int> v[P];
int main()
{
int n;
in >> n;
for(int i = 0; i < n ; i++ )
{
int op, x;
in >> op >> x;
if( op==1 ){
int h = x % P;
auto it = find(v[h].begin(), v[h].end(), x);
if (it == v[h].end())
v[h].push_back(x);
}
else if( op==2 ){
int h = x % P;
auto it = find(v[h].begin(), v[h].end(), x);
if (it != v[h].end())
v[h].erase(it);
} else if( op==3 ){
int h = x % P;
auto it = find(v[h].begin(), v[h].end(), x);
if (it != v[h].end())
out << "1\n";
else
out << "0\n";
}
}
return 0;
}