Cod sursa(job #3203389)

Utilizator AlexMoto2006Motoasca Alexandru-Lucian AlexMoto2006 Data 13 februarie 2024 16:59:08
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.51 kb
#include <fstream>
#include <set>
using namespace std;

ifstream cin("hashuri.in");
ofstream cout("hashuri.out");

int n,x,c;
multiset<int> s;
int nr;
int main()
{
	cin >> n;
	for (int i = 1; i <= n; i++)
	{
		cin >> c;
		if (c == 1)
		{
			cin >> x;
			if (s.find(x) == s.end())
			{
				s.insert(x);
			}
		}
		if (c == 2)
		{
			cin >> x;
			s.erase(x);
		}
		if (c == 3)
		{
			cin >> x;
			if(s.count(x) == 0)
				cout << "0\n";
			else
				cout << "1\n";
		}
	}
    return 0;
}