Cod sursa(job #1376657)

Utilizator dianaa21Diana Pislaru dianaa21 Data 5 martie 2015 18:12:40
Problema Hashuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.61 kb
#include <fstream>
#include <unordered_set>
using namespace std;
ifstream is ("hashuri.in");
ofstream os ("hashuri.out");

unordered_set <int> S;
int N, type, x, cnt;

int main()
{
    is >> N;
    for(int i = 1; i <= N; ++i)
    {
        is >> type >> x;
        switch(type) {
            case 1:
                S.insert(x);
                break;
            case 2:
                S.erase(x);
                break;
            case 3:
                if(S.find(x) == S.end()) os << "0\n";
                else os << "1\n";
        }
    }
    is.close();
    os.close();
    return 0;
}