Cod sursa(job #886727)

Utilizator SPDionisSpinei Dionis SPDionis Data 23 februarie 2013 10:36:00
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.64 kb
#include <fstream>
#include <map>


std::ifstream in("hashuri.in");
std::ofstream out("hashuri.out");
std::map<int, int> a;

void op1(int x)
{
    if ( a[x] == 0 ) a[x] = 1;
}

void op2 (int x)
{
    if ( a[x] == 1 ) a[x] = 0;
}

int op3 (int x)
{
    if ( a[x] == 1 ) return 1;
    else return 0;
}



int main()
{
    int n;
    in >> n;

    for (int i = 0; i < n; ++i)
        {
            int a,b;
            in >> a >> b;
            if ( a == 1 ) op1(b);
            else if ( a == 2 ) op2(b);
            else if ( a == 3 ) out << op3(b) << '\n';
        }

    in.close();
    out.close();
    return 0;
}