Cod sursa(job #3230331)

Utilizator Luca_georgescuLucageorgescu Luca_georgescu Data 20 mai 2024 15:50:21
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.74 kb
#include <bits/stdc++.h>
#define mod 666013

using namespace std;

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

int n,c,x,k;

unordered_map <int,int> a;

/*bool findx(int x)
{
    int k=x%mod;
    for (auto a:h[k] )
        if ( a==x )
           return 1;
    return 0;
}

void insertx (int x)
{
    int k=x%mod;
    h[k].push_back(x);
}

void erasex (int x)
{
    int k=x%mod;
    vector <int> cpy;
    for (auto a:h[k] )
        if ( a!=x )
           cpy.push_back(a);
    h[k]=cpy;
}*/


int main()
{
    f >> n;
    for (int i=1; i<=n; i++ )
    {
        f >> c >> x;
        if ( c==1 )
            a[x]++;
        else if ( c==2 && a[x] )
            a[x]--;
        else if ( c==3 )
            g << (a[x]>0) << '\n';
    }
    return 0;
}