Cod sursa(job #3143744)

Utilizator AlexPlesescuAlexPlesescu AlexPlesescu Data 1 august 2023 21:43:37
Problema Hashuri Scor 70
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");

int n,x,nr;
int main()
{
    unordered_map<long long,bool> mp;
    fin >> n;
    for(int i=1; i <= n; i++)
    {
        fin >> x >> nr;
        if(x == 1 || x == 2)
        {
            if(x == 1)
            {
                if(mp.find(nr) == mp.end())
                    mp[nr] = 1;
            }
            else
            {
                if(mp.find(nr) != mp.end())
                    mp[nr] = 0;
            }
        }
        else
        {
            if(mp[nr] != 0)
                fout << 1 << '\n';
            else
                fout << 0 << '\n';
        }
    }
    return 0;
}