Cod sursa(job #1599012)
Utilizator | Data | 13 februarie 2016 15:35:48 | |
---|---|---|---|
Problema | Hashuri | Scor | 0 |
Compilator | cpp | Status | done |
Runda | Arhiva educationala | Marime | 0.39 kb |
#include <fstream>
#include <map>
using namespace std;
int N, NR;
map <int, int> M;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
int main()
{
int i, tip, x;
f >> N;
for (i = 1; i <= N; i++)
{
f >> tip >> x;
if (tip == 1 && M.find(x) == M.end()) M[x] = ++NR;
if (tip == 2) M.erase(x);
if (tip == 3) g<< M.find(x) != M.end()<<"\n";
}
return 0;
}