Cod sursa(job #397681)

Utilizator rayvianPricope Razvan rayvian Data 17 februarie 2010 12:30:59
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.46 kb
#include <iostream>
#include <fstream>
#include <map>
using namespace std;

map<int,bool> v;

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

  int n;
  int op,nr;
  f>>n;

  for(int i=1; i<=n; i++)
  {
    f>>op>>nr;
    if(op==1)
      v[nr]=true;
    if(op==2)
      v.erase(nr);
    else if(op==3)
    {
      if(v.count(nr))
        g<<1<<endl;
      else
        g<<0<<endl;
    }


  }

  return 0;
}