Cod sursa(job #2883877)

Utilizator T1raduTaerel Radu Nicolae T1radu Data 1 aprilie 2022 22:18:27
Problema Hashuri Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.54 kb
#include <fstream>
#include <map>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
int n,op,x;
map<int,int> M;
int main()
{
    fin >> n;
    for(int i=1;i<=n;i++)
    {
        fin >> op >> x;
        if(op==1)
        {
            if(M[x]==0) M[x]++;
        }
        else if(op==2)
        {
            if(M[x]!=0) M[x]--;
        }
        else
        {
            if(M[x]==1) fout << "1";
            else fout << "0";
            fout << "\n";
        }
    }
    return 0;
}