Cod sursa(job #2868363)

Utilizator 21CalaDarius Calaianu 21Cala Data 10 martie 2022 21:21:58
Problema Hashuri Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.86 kb
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
#include <stack>
#include <set>
#define NMAX 100005
using namespace std;
ifstream fin ("hashuri.in");
ofstream fout ("hashuri.out");
int n,m;
multiset <int> myhash;
int main()
{
    int t,a;
    fin >> n;
    for(int i=0;i<n;++i)
    {
        fin >> t;
        if(t==1)
        {
            fin >> a;
            if(myhash.find(a)==myhash.end())
                myhash.insert(a);
        }
        else if(t==2)
        {
            fin >> a;
            if(myhash.find(a)!=myhash.end())
                myhash.erase(myhash.find(a));
        }
        else
        {
            fin >> a;
            if(myhash.find(a)!=myhash.end())
                fout << 1 << '\n';
            else
                fout << 0 << '\n';
        }
    }
    return 0;
}