Cod sursa(job #2330627)

Utilizator DariusDCDarius Capolna DariusDC Data 28 ianuarie 2019 17:55:09
Problema Hashuri Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.68 kb
#include <iostream>
#include <fstream>
#include <map>

using namespace std;

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

map <int,int> mp;

int main()
{
    int n;
    fin >> n;
    while (n--)
    {
        int tip;
        fin >> tip;
        if (tip == 1)
        {
            int x;
            fin >> x;
            mp[x]++;
        }
        else if (tip == 2)
        {
            int x;
            fin >> x;
            mp.erase(x);
        }
        else{
            int x;
            fin >> x;
            if (mp[x])
                fout << "1\n";
            else
                fout << "0\n";
        }
    }
    return 0;
}