Cod sursa(job #2549529)

Utilizator gabbie02Thomits Gabriel gabbie02 Data 17 februarie 2020 19:21:41
Problema Hashuri Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.6 kb
#include <fstream>
#include <map>

using namespace std;

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

int main()
{
    map<unsigned int, bool> elem;
    unsigned int n, x;
    char op;
    fin >> n;
    while(n){
        fin >> op >> x;
        switch(op){
            case '1':
                elem[x] = true;
                break;
            case '2':
                elem[x] = false;
                break;
            case '3':
                fout << (elem.find(x) != elem.end() && elem[x]) << '\n';
                break;
        }
        n--;
    }
    return 0;
}