Cod sursa(job #2027778)

Utilizator vladm98Munteanu Vlad vladm98 Data 26 septembrie 2017 18:21:45
Problema Hashuri Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.55 kb
#include <bits/stdc++.h>

using namespace std;
int modulo = 666013;
map <int, int> cheie[666014];
int main(int argc, char const *argv[])
{
	ifstream fin ("cheieuri.in");
	ofstream fout ("cheieuri.out");
	int n;
	fin >> n;
	for (int i = 1; i<=n; ++i)
	{
		int type, x;
		fin >> type >> x;
		int y = x%modulo;
		if (type == 1)
		{
			cheie[y][x]++;
		}
		if (type == 2)
		{
			if (cheie[y].count(x) == 0) continue;
			cheie[y].erase(x);
		}
		if (type == 3)
		{
			if (cheie[y].count(x) == 0)
				fout << 0 << '\n';
			else fout << 1 << '\n';
		}
	}
	return 0;
}