Cod sursa(job #2623712)

Utilizator anacomoAna-Maria Comorasu anacomo Data 3 iunie 2020 17:01:34
Problema Hashuri Scor 60
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.73 kb
#include <bits/stdc++.h>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");

map<int, bool> hashmap;
int main()
{
    int choice, n;
    int element;
    fin >> n;
    for (int i = 0; i < n; ++i)
    {
        fin >> choice;
        switch (choice)
        {
        case 1:
            fin >> element;
            hashmap[element] = true;
            break;
        case 2:
            fin >> element;
            hashmap[element] = false;
            break;
        case 3:
            fin >> element;
            if (hashmap[element] == true)
                fout << 1 << endl;
            else
                fout << 0 << endl;
            break;
        default:
            break;
        }
    }
    return 0;
}