Cod sursa(job #2734080)

Utilizator redstonegamer22Andrei Ion redstonegamer22 Data 31 martie 2021 12:54:00
Problema Hashuri Scor 0
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.72 kb
#include <bits/stdc++.h>

using namespace std;

#ifndef LOCAL

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

#define cin in
#define cout out

#endif //LOCAL

int main()
{
    int n; cin >> n;
    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;
            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
        }
    }
}