Cod sursa(job #1279856)

Utilizator diana-t95FMI Tudoreanu Diana Elena diana-t95 Data 30 noiembrie 2014 23:35:45
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.42 kb
#include<fstream>
#include<map>
using namespace std;
map <int, int> mymap;
int main()
{
    ifstream f("hashuri.in");
    ofstream g("hashuri.out");
    int n, i, op, x, nr=0;
    f>>n;
    for (i=0;i<n;i++)
    {
        f>>op>>x;
        if (op==1) if (mymap.find(x)==mymap.end()) mymap[x]=++nr;
        if (op==2) mymap.erase(x);
        if (op==3) if (mymap.find(x)!=mymap.end()) g<<"1\n"; else g<<"0\n";
    }
}