Cod sursa(job #1245686)
| Utilizator | Data | 19 octombrie 2014 20:39:06 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 100 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.58 kb |
#include <iostream>
#include <fstream>
#include <unordered_set>
int main()
{
std::ifstream fin("hashuri.in");
std::ofstream fout("hashuri.out");
int N;
fin >> N;
std::unordered_set<long long> set(N);
for (; N; --N) {
int type;
long long nr;
fin >> type >> nr;
if (type == 1)
set.emplace(nr);
else if (type == 2 && set.count(nr))
set.erase(set.find(nr));
else if (type == 3)
fout << (set.count(nr) ? "1\n" : "0\n");
}
fin.close();
fout.close();
return 0;
}
