Cod sursa(job #2035290)

Utilizator HumikoPostu Alexandru Humiko Data 9 octombrie 2017 10:28:17
Problema Hashuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.63 kb
#include <fstream>
#include <map>

using namespace std;

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

const int maxim = 666013;
map <int, int> f[666025];

int main()
{
    int n, op;
    long long x;
    fin>>n;
    while ( n-- )
    {
        fin>>op>>x;
        int h = x % maxim;
        if ( op == 1 )
            f[h][x]++;
        if ( op == 2 )
            if ( f[h].count(x) != 0 )
                f[h].erase(x);
        if ( op == 3 )
        {
            if ( f[h].count(x) != 0 )
                fout<<"1"<<'\n';
            else
                fout<<"0"<<'\n';
        }
    }
}