Cod sursa(job #2693118)

Utilizator martinmiere133Cranga Antonio martinmiere133 Data 4 ianuarie 2021 20:31:04
Problema Hashuri Scor 10
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.85 kb
#include <stdio.h>
#include <stdlib.h>
#include <iostream>
#include <fstream>
#include <cstring>
#include <algorithm>
#define INF 1e9
#include <string>
#include <stack>
#include <bitset>
#include <queue>
#include <map>
#include <set>
#include <cstring>
#include <cmath>
#include <sstream>
#include <iomanip>
#include <list>
using namespace std;
typedef long long ll;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
int main()
{
    int n;
    f>>n;map<int,int> mapa;
    for(int i=1;i<=n;i++)
    {
        int op , x;
        f>>op>>x;
        if(op == 1 && mapa.find(x) == mapa.end())
        {
            mapa[x]++;
        }
        else if(op == 2)
        {
            if(mapa[x] > 0)mapa.erase(x);
        }
        else
        {
            g<<(mapa.find(x)!= mapa.end())<<'\n';
        }
    }
    return 0;
}