Cod sursa(job #2741582)

Utilizator redstonegamer22Andrei Ion redstonegamer22 Data 16 aprilie 2021 16:21:44
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.8 kb
#include <bits/stdc++.h>
#include <tr1/unordered_set>

using namespace std;

#ifndef LOCAL

ifstream in("hashuri.in");
ofstream out("hashuri.out");

#define cin in
#define cout out

#endif //LOCAL

int main()
{
    int n; cin >> n;
    tr1::unordered_set<int> s;
    for(int i = 0; i < n; i++)
    {
        int q; cin >> q;
        if(q == 1)
        {
            int x; cin >> x;
            s.insert(x);
        }
        if(q == 2)
        {
            int x; cin >> x;
            if(s.find(x) != s.end())
                s.erase(x);
        }
        if(q == 3)
        {
            int x; cin >> x;
            if(s.find(x) != s.end())
                cout << "1\n";
            else
                cout << "0\n";

            #ifdef LOCAL
                cout.flush();
            #endif
        }
    }
}