Cod sursa(job #918908)

Utilizator PatrikStepan Patrik Patrik Data 19 martie 2013 11:06:18
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.78 kb
    #include<cstdio>
    #include<set>
    using namespace std;
    #define MAX 1000000
    int N , t , x;
    multiset<int>  Q;

    int main()
    {
        freopen("hashuri.in" , "r" , stdin );
        freopen("hashuri.out" , "w" , stdout );
        scanf("%d" , &N );
        for( int i = 1 ; i <= N ; ++i )
            {
                scanf("%d%d" , &t , &x );
                if(t == 1)
                    if(Q.count(x) == 0)Q.insert(x);
                if(t == 2)
                    if(Q.count(x))Q.erase(Q.find(x));
                if(t == 3)
                {
                    if(Q.count(x))
                        printf("1\n");
                    else
                        printf("0\n");
                }
            }
        return 0;
    }