Cod sursa(job #2364163)

Utilizator GhSamuelGherasim Teodor-Samuel GhSamuel Data 3 martie 2019 21:46:20
Problema Hashuri Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.58 kb
#include <bits/stdc++.h>

using namespace std;
set <int> A;
set <int> :: iterator it;

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

int n;

void solve(int c, int val)
{
    if (c == 1)
        A.insert(val);
    if (c == 2)
        A.erase(val);
    if (c == 3) {
        if (A.find(val) != A.end())
            g << "1\n";
        else
            g << "0\n";
    }

}

void read()
{
    f >> n;

    int c, val;
    for (int i = 1; i <= n; ++i) {
        f >> c >> val;
        solve(c, val);
    }
}

int main()
{
    read();
    return 0;
}