Cod sursa(job #1097143)

Utilizator bogdanpaunFMI Paun Bogdan Gabriel bogdanpaun Data 3 februarie 2014 02:06:19
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.62 kb
#include <fstream>
#include <map>
using namespace std;

int main()
{
    ifstream f("hashuri.in");
    ofstream g("hashuri.out");
    int N;   f>> N;
    int OPTION,VALUE;
    std::map<int,bool> MyMap;
    for(; N; --N ){
        f>>OPTION>>VALUE;
        if( OPTION == 1 ){
                if( MyMap.find( VALUE ) == MyMap.end() )  MyMap[VALUE]=1;  }
        else
        if( OPTION == 2  ){
                if( MyMap.find( VALUE ) != MyMap.end() ) MyMap.erase(VALUE);   }
        else
        if( OPTION == 3 )
                g<< (MyMap.find( VALUE ) != MyMap.end())   << '\n';




    }

    return 0;
}