Pagini recente » Cod sursa (job #2162925) | Cod sursa (job #24573) | Cod sursa (job #1375950) | Cod sursa (job #128496) | Cod sursa (job #2634782)
#include <fstream>
#include <set>
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
const int MOD = 666013;
int Q;
set < int > G[(MOD + 5)];
static inline void Add (int X)
{
int g = X % MOD;
G[g].insert(X);
return;
}
static inline void Erase (int X)
{
int g = X % MOD;
G[g].erase(X);
return;
}
static inline bool Ask (int X)
{
int g = X % MOD;
if(G[g].count(X))
return 1;
return 0;
}
static inline void TestCase ()
{
int Type = 0, X = 0;
f >> Type >> X;
if(Type == 1)
Add(X);
if(Type == 2)
Erase(X);
if(Type == 3)
g << Ask(X) << '\n';
return;
}
int main()
{
f.tie(nullptr);
f >> Q;
while(Q--)
TestCase();
return 0;
}