Cod sursa(job #2698031)

Utilizator VladNANegoita Vlad-Andrei VladNA Data 20 ianuarie 2021 18:30:55
Problema Hashuri Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.53 kb
#include <bits/stdc++.h>

using namespace std;

ifstream fin("hashuri.in");
ofstream fout("hashuri.out");

map<int, int> mp;

int main()
{
    int n,op,x;
    fin>>n;
    for(int i=1;i<=n;i++)
    {
        fin>>op>>x;
        if(op==1){
            if(mp.find(x)==mp.end())
                mp[x]=1;
        }
        else if(op==2)
        {
            if(mp.find(x)!=mp.end())
                mp.erase(x);
        }
        else
            fout<< (int)(mp.find(x)!=mp.end())<<'\n';
    }
    return 0;
}