Cod sursa(job #2337682)

Utilizator WayronUrsu Ianis-Vlad Wayron Data 6 februarie 2019 16:59:10
Problema Hashuri Scor 60
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.52 kb
#include <bits/stdc++.h>
using namespace std;

int main()
{
    map<int, int> h;

    int n;

    ifstream fin("hashuri.in");
    ofstream fout("hashuri.out");

    fin>>n;

    int op, x;
    for(int i=1; i<=n; i++){
        fin>>op>>x;
        switch(op){
            case 1: h.insert(pair<int, int>(x, x));
            break;
            case 2: h.erase(x);
            break;
            default:
                if(h.count(x)) fout<<1<<endl;
                else fout<<0<<endl;
        }
    }
}