Pagini recente » Cod sursa (job #1109378) | Cod sursa (job #611586) | Cod sursa (job #1598407) | Cod sursa (job #1507706) | Cod sursa (job #2573709)
#include <bits/stdc++.h>
#define mod 666013
using namespace std;
ifstream fin ("hashuri.in");
ofstream fout ("hashuri.out");
void usain_bolt()
{
ios::sync_with_stdio(false);
fin.tie(0);
}
vector < int > h[mod];
void add(int x)
{
int key = x % mod;
h[key].push_back(x);
}
bool findd(int x)
{
int key = x % mod;
for(size_t j = 0; j < h[key].size(); ++j) {
if(h[key][j] == x) return true;
}
return false;
}
void eraser(int x)
{
int key = x % mod;
vector < int > ::iterator it;
for(it = h[key].begin(); it != h[key].end(); ++it) {
if(*it == x) break;
}
h[key].erase(it);
}
int main()
{
usain_bolt();
int q;
fin >> q;
for(; q; --q) {
int type, x;
fin >> type >> x;
if(type == 1) {
if(findd(x) == false) add(x);
}
else if(type == 2) {
if(findd(x) == true) eraser(x);
}
else fout << findd(x) << "\n";
}
return 0;
}