Cod sursa(job #2275612)

Utilizator isav_costinVlad Costin Andrei isav_costin Data 3 noiembrie 2018 12:46:39
Problema Hashuri Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.58 kb
#include <cstdio>
#include <map>

using namespace std;

map<int,bool> m;

inline void adauga( int x )
{
  m[x]=1;
}

inline void elimina( int x )
{
  m[x]=0;
}

inline int verifica( int x )
{
  return m[x];
}

int main()
{
  freopen( "hashuri.in", "r", stdin );
  freopen( "hashuri.out", "w", stdout );

  int n, op, k;

  scanf( "%d", &n );

  for( int i=1;i<=n;i++ )
  {
    scanf( "%d%d", &op, &k );

    if( op==1 )
      adauga(k);
    else
      if( op==2 )
        elimina(k);
      else
        printf( "%d\n", verifica(k) );
  }

  return 0;
}