Cod sursa(job #2718419)
| Utilizator | Data | 8 martie 2021 18:44:43 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 70 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.71 kb |
#include <iostream>
#include <fstream>
#include <set>
#define p 999983
using namespace std;
ifstream in("hashuri.in");
ofstream out("hashuri.out");
set <int> h[999983];
void adauga(int a)
{
if(h[a%p].count(a))return;
h[a%p].insert(a);
}
void sterge(int a)
{
if(!h[a%p].count(a))return;
h[a%p].erase(a);
}
int n,cod,x;
int main()
{
in>>n;
for(int i=1;i<=n;i++)
{
in>>cod>>x;
switch (cod)
{
case 1:
adauga(x);
break;
case 2:
sterge(x);
break;
case 3:
out<<h[x%p].count(x)<<'\n';
break;
}
}
return 0;
}
