Cod sursa(job #2894677)

Utilizator catarau.bianca.Bianca Catarau catarau.bianca. Data 28 aprilie 2022 01:11:58
Problema Hashuri Scor 30
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.51 kb
#include <fstream>
#include <vector>
#include <algorithm>

using namespace std;

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

vector<int> h;

int main()
{
    int n;
    f>>n;
    for(int i=1;i<=n;i++)
    {
        int o,x;
        f>>o>>x;
        if(o==1) {h.push_back(x); continue;}
        else if(o==2 && find(h.begin(), h.end(), x) != h.end()) {h.erase(find(h.begin(), h.end(), x)); continue;}
        else if(o==3)find(h.begin(), h.end(), x) == h.end()?g<<"0\n":g<<"1\n";
    }
}