Cod sursa(job #2035283)

Utilizator HumikoPostu Alexandru Humiko Data 9 octombrie 2017 10:20:27
Problema Hashuri Scor 30
Compilator cpp Status done
Runda Arhiva educationala Marime 0.7 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 )
        {
            if ( f[x][h] == 0 )
                f[x][h] = 1;
        }
        if ( op == 2 )
        {
            if ( f[x][h] != 0 )
                f[x][h] = 0;
        }
        if ( op == 3 )
        {
            if ( f[x][h] != 0 )
                fout<<"1"<<'\n';
            else
                fout<<"0"<<'\n';

        }
    }

}