Cod sursa(job #2846661)

Utilizator PechiPecherle George Pechi Data 9 februarie 2022 14:48:49
Problema Hashuri Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.5 kb
#include<iostream>
#include<fstream>
#include<unordered_map>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");

unordered_map<int,int> mapa;
int n;

void operatie()
{
  int tip,x;
  fin>>tip>>x;
  switch (tip) {
    case 1: mapa[x]=1; break;
    case 2: mapa.erase(x); break;
    case 3: fout<<(mapa.find(x)!= mapa.end())<<'\n'; break;
  }
  return;
}

int main()
{
  ios::sync_with_stdio(false);
  fin>>n;
  while(n--)
    operatie();
  return 0;
}