Cod sursa(job #2738955)
| Utilizator | Data | 6 aprilie 2021 16:48:31 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 70 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva educationala | Marime | 0.67 kb |
#include <iostream>
#include <fstream>
#include <set>
#include <bitset>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
const int N= 20000000;
bitset<N+10> b;
int main() {
int n, x, op;
set<int> s;
fin >> n;
for(int i=0; i<n; ++i)
{
fin >> op >> x;
if (op == 1)
{
s.insert(x);
b[x%N]=1;
}
else if (op == 2)
{ if(b[x%N] != 0)
s.erase(x);
}
else
{
if(b[x%N] == 1 && s.find(x)!=s.end())
fout << 1 << "\n";
else
fout << 0 << "\n";
}
}
return 0;
}
