Cod sursa(job #1123726)

Utilizator alin.18Chedea Alin alin.18 Data 26 februarie 2014 09:51:42
Problema Hashuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 1.49 kb
#include <fstream>
#include <iostream>
#include <vector>
#include <bitset>
#include <string.h>
#include <algorithm>
#include <iomanip>
#include <math.h>
#include <time.h>
#include <stdlib.h>
#include <set>
#include <map>
#include <string>
#include <queue>
#include <deque>
#include <tr1/unordered_set>

using namespace std;
using namespace tr1;

const char infile[] = "hashuri.in";
const char outfile[] = "hashuri.out";

ifstream fin(infile);
ofstream fout(outfile);

const int MAXN = 100005;
const int oo = 0x3f3f3f3f;

typedef vector<int> Graph[MAXN];
typedef vector<int> :: iterator It;

const inline int min(const int &a, const int &b) { if( a > b ) return b;   return a; }
const inline int max(const int &a, const int &b) { if( a < b ) return b;   return a; }
const inline void Get_min(int &a, const int b)    { if( a > b ) a = b; }
const inline void Get_max(int &a, const int b)    { if( a < b ) a = b; }

unordered_set <int> _hash;
int N;

int main() {
    fin >> N;
    for(int i = 1 ; i <= N ; ++ i) {
        int x, y;
        fin >> x >> y;
        switch(x) {
        case 1:
            if(_hash.find(y) == _hash.end())
                _hash.insert(y);
            break;
        case 2:
            if(_hash.find(y) != _hash.end())
                _hash.erase(y);
            break;
        case 3:
            fout << (_hash.find(y) != _hash.end()) << '\n';
            break;
        }
    }
    fin.close();
    fout.close();
    return 0;
}