Cod sursa(job #575992)

Utilizator wamfeverDobos Ionut wamfever Data 9 aprilie 2011 08:54:17
Problema Hashuri Scor 30
Compilator cpp Status done
Runda Arhiva educationala Marime 0.53 kb
#include<fstream>
#include<algorithm>
#define MAx 2000001
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");

int n, nr, op;
int v[MAx + MAx + MAx];
void solve(int k, int x)
{
    if(k==1)
    {
        if(!v[x]) ++v[x];
    }

    if(k==2)
    {
        if(v[x]) --v[x];
    }

    if(k==3)
    {
        if(v[x]) fout << '1' << "\n";
        else fout << '0' << "\n";
    }
}

int main()
{
    fin >> n;
    for(int i=1; i<=n; i++)
    {
        fin >> op >> nr;
        solve(op, nr);
    }
    return 0;
}