Cod sursa(job #711882)
| Utilizator | Data | 12 martie 2012 20:49:38 | |
|---|---|---|---|
| Problema | Hashuri | Scor | 70 |
| Compilator | cpp | Status | done |
| Runda | Arhiva educationala | Marime | 0.55 kb |
#include <fstream>
#include <map>
#include <vector>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
map<int, int> M;
int n, tip, x, nr;
int main()
{
fin >> n;
for (int i = 1; i <= n; ++i)
{
fin >> tip >> x;
if (tip == 1 && M.find(x) == M.end()) M[x] == ++nr;
if (tip == 2) M.erase(x);
if (tip == 3)
if (M.find(x) == M.end()) fout << "0\n";
else fout << "1\n";
}
fin.close();
fout.close();
return 0;
}
