Cod sursa(job #397146)

Utilizator swxxIoo Andrei Rares swxx Data 16 februarie 2010 15:07:29
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.52 kb
#include<fstream>
# include<map>
using namespace std;

int n,nr;
map <int, int> M;
int main()
{  ifstream f ("hashuri.in");
   ofstream g ("hashuri.out");
   int i,tip,x;
   f>>n;
   for(i=1;i<=n;i++)
   {
                    f>>tip>>x;
                    if ((tip == 1) && M.find(x)==M.end()) M[x]= ++nr;
                    if (tip == 2) M.erase(x);
                    if (tip == 3) g<<(M.find(x) !=M.end())<<"\n";
                    }
g.close();
f.close();

                    
    return 0;
    }