Pagini recente » Cod sursa (job #874881) | Cod sursa (job #596932) | Cod sursa (job #335216) | Cod sursa (job #653908) | Cod sursa (job #1492869)
#include <fstream>
#include <set>
using namespace std;
ifstream ka("hashuri.in");
ofstream ki("hashuri.out");
const int MOD = 666013;
int n, c, x;
set <int> numere[MOD + 1];
bool cauta(int t)
{
bool gasit = false;
for(set<int>::iterator it = numere[t % MOD].begin(); it != numere[t % MOD].end() && !gasit; ++it)
if(*it == x)
gasit = true;
return gasit;
}
int main()
{
ka >> n;
for(int i = 1; i <= n; i++)
{
ka >> c >> x;
if(c == 1)
numere[x % MOD].insert(x);
else if(c == 2)
numere[x % MOD].erase(x);
else
{
if(cauta(x))
ki << 1 << '\n';
else
ki << 0 << '\n';
}
}
}