Cod sursa(job #2275645)

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

using namespace std;

set<int> m;

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 )
      m.insert(k);
    else
      if( op==2 )
        m.erase(k);
      else
        if( m.find(k)!=m.end() )
          printf( "1\n" );
        else
          printf( "0\n" );
  }

  return 0;
}