Cod sursa(job #1486977)

Utilizator Corneliu10Dumitru Corneliu Corneliu10 Data 15 septembrie 2015 20:19:49
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.56 kb
#include <iostream>
#include <set>
#include <fstream>
#define maxN 1000005
using namespace std;

set <int> heap;
int n;

int main()
{
    int p,x;
    ifstream f("hashuri.in");
    ofstream g("hashuri.out");

    f>>n;

    for(int i=0;i<n;i++)
    {
        f>>p>>x;

        switch(p)
        {
            case 1:
                heap.insert(x);
                break;
            case 2:
                heap.erase(x);
                break;
            case 3:
                g<<(heap.find(x) != heap.end())<<"\n";
        }
    }
}