Cod sursa(job #2722599)

Utilizator alexandru021Alexandru Gabriel alexandru021 Data 13 martie 2021 00:45:31
Problema Hashuri Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.45 kb
#include <iostream>
#include <fstream>
#include <unordered_map>
using namespace std;

ifstream f("hashuri.in");
ofstream g("hashuri.out");

int n;
unordered_map <int, bool> m;

int main()
{
    f >> n;
    int c, x;
    for(int i = 1; i <= n; ++i) {
        f >> c >> x;
        if(c == 1)
            m[x] = true;
        else if(c == 2 && m[x])
                m[x] = false;
        else if(c == 3) g << (m[x] ? "1\n" : "0\n");
    }
}