Cod sursa(job #2434066)

Utilizator ShayTeodor Matei Shay Data 30 iunie 2019 15:39:22
Problema Hashuri Scor 100
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.49 kb
#include <fstream>
#include <unordered_map>

int main() {
	std::ifstream cin("hashuri.in");
	std::ofstream cout("hashuri.out");
	std::ios::sync_with_stdio(false);
	int n, op_type, x;
	
	cin >> n;
	std::unordered_map<int, int> map;
	for (int i = 0 ; i < n ; ++i) {
		cin >> op_type >> x;
		switch(op_type) {
			case 1: if (map.find(x) == map.end()) {
						map[x++];
					}
					break;
			case 2: map.erase(x);
					break;
			default: cout << (map.find(x) != map.end()) << '\n';
		}
	}

	return 0;
}