Cod sursa(job #1410931)

Utilizator andreimdvMoldovan Andrei andreimdv Data 31 martie 2015 12:46:16
Problema Hashuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.81 kb
#include<fstream>
#include<set>
using namespace std;

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

int n,tip,x,i,hs;
int mod=666013;
set<int> s[666050];

int main()
{
    fin>>n;
    for(i=1;i<=n;++i)
    {
        fin>>tip>>x;
        hs=x%mod;
        if(tip==1)
        {
           // if(s[hs].find(x)!=s[hs].end())
                s[hs].insert(x);
            continue;
        }
        if(tip==2)
        {
           // if(s[hs].find(x)!=s[hs].end())
                s[hs].erase(x);
            continue;
        }
        if(tip==3)
        {
            if(s[hs].find(x)!=s[hs].end())
            {
                fout<<"1\n";
            }
            else
            {
                fout<<"0\n";
            }
        }

    }





    return 0;
}