Cod sursa(job #2571560)

Utilizator baranceanuBaranceanu Vlad baranceanu Data 5 martie 2020 08:10:50
Problema Hashuri Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.72 kb
#include <fstream>
#include <map>
#include <vector>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
map<int,int> harta;
int n,nr=1;
int main()
{
    int i,c,x;
    fin>>n;
    for(i=1;i<=n;i++)
    {
        fin>>c>>x;
        if(c==1)
        {
           if(harta.find(x)==harta.end())
           {
               harta[x]=nr;
           }
        }
        else
        {
            if(c==2)
            {
                harta.erase(x);
            }
            else
            {
                if(harta.find(x)==harta.end())
                    fout<<0<<'\n';
                else
                    fout<<1<<'\n';
            }
        }
    }
    return 0;
}