Cod sursa(job #1795768)

Utilizator mihai.alphamihai craciun mihai.alpha Data 2 noiembrie 2016 20:36:06
Problema Hashuri Scor 40
Compilator cpp Status done
Runda Arhiva educationala Marime 0.62 kb
#include <bits/stdc++.h>

using namespace std;
multiset<int>hash1;
FILE *fin, *fout;
void desch()  {
    fin = fopen("hashuri.in", "r");
    fout = fopen("hashuri.out", "w");
}
void inch()  {
    fclose(fin);
    fclose(fout);
}
int main()  {
    desch();
    int n;
    fscanf(fin, "%d", &n);
    int i;
    for(i = 0;i < n;i++)  {
        int op, x;
        fscanf(fin, "%d%d", &op, &x);
        if(op == 1)  {
            hash1.insert(x);
        }
        if(op == 2)  {
            hash1.erase(x);
        }
        if(op == 3)  {
            fprintf(fout, "%d\n", hash1.count(x));
        }
    }
    inch();
    return 0;
}