Pagini recente » Cod sursa (job #3171846) | Cod sursa (job #1126936) | Cod sursa (job #1275476) | Cod sursa (job #2968806) | Cod sursa (job #1952587)
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
const int mod1 = 777013, mod2 = 666013;
int V[mod1 + 1], V2[mod2 + 1];
int N;
void inserare(int x)
{
int ind1 = x % mod1;
int ind2 = x % mod2;
if (V[ind1] == 0 && V2[ind2] == 0)
V[ind1] = V2[ind2] = 1;
}
void stergere(int x)
{
int ind1 = x % mod1;
int ind2 = x % mod2;
V[ind1] = V2[ind2] = 0;
}
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 << (V[x % mod1] && V2[x % mod2]) << "\n";
}
f.close();
g.close();
}