Pagini recente » Cod sursa (job #1453861) | Cod sursa (job #2973697) | Cod sursa (job #1493633) | Cod sursa (job #3235412) | Cod sursa (job #1952577)
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
const int mod = 777013;
vector <int> G[mod + 1];
int N;
void inserare(int x)
{
int ind = x % mod;
if (find(G[ind].begin(), G[ind].end(), x) == G[ind].end())
G[ind].push_back(x);
}
void stergere(int x)
{
int ind = x % mod;
vector <int> :: iterator it = find(G[ind].begin(), G[ind].end(), x);
if (it != G[ind].end())
G[ind].erase(it);
}
int main()
{
f >> N;
for (; N--;)
{
int op, x;
f >> op >> x;
if (op == 1)
inserare(x);
else if (op == 2)
stergere(x);
else
g << (find(G[x % mod].begin(), G[x % mod].end(), x) != G[x % mod].end()) << "\n";
}
f.close();
g.close();
}