Cod sursa(job #2693117)

Utilizator martinmiere133Cranga Antonio martinmiere133 Data 4 ianuarie 2021 20:29:26
Problema Hashuri Scor 70
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.83 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[x]++;
        }
        else if(op == 2)
        {
            if(mapa[x] > 0)mapa[x]--;
        }
        else
        {
            if(mapa[x])g<<1<<'\n';
            else g<<0<<'\n';
        }
    }
    return 0;
}