Cod sursa(job #1686288)

Utilizator llalexandruLungu Alexandru Ioan llalexandru Data 12 aprilie 2016 10:18:44
Problema Hashuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.56 kb
#include <fstream>
#include <set>
#define MOD 666013

using namespace std;

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

set <int> V[MOD];

int n, t, x, i, c;

int main()
{
    fin>>n;
    for (i=1; i<=n; i++)
    {
        fin>>t>>x;
        c=x%MOD;
        if (t==1 && V[c].find(x)==V[c].end())
            V[c].insert(x);
        if (t==2)
            V[c].erase(x);
        if (t==3)
            if (V[c].find(x)!=V[c].end())
                fout<<1<<'\n';
            else
                fout<<0<<'\n';
    }
    return 0;
}