Cod sursa(job #2392064)

Utilizator vladadAndries Vlad Andrei vladad Data 29 martie 2019 17:11:37
Problema Hashuri Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.56 kb
#include<bits/stdc++.h>
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
int n, p, x, nr, minim, k;
set<int>v;
set<int>::iterator it;
int main()
{
    f>>n;
    for(int i=1; i<=n; i++)
    {
        f>>p;
        if(p==1)
        {
            f>>x;
            v.insert(x);
        }
        else if(p==2)
        {
            f>>x;
            v.erase(x);
        }
        else
        {
            f>>x;
            if(v.find(x)!=v.end()) g<<1<<'\n';
            else g<<0<<'\n';
        }
    }
    return 0;
}