Cod sursa(job #1095789)

Utilizator andreifirstCioara Andrei Ioan andreifirst Data 31 ianuarie 2014 21:23:19
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.66 kb
#include <iostream>
#include <fstream>
#include <map>

#define e '\n'

using namespace std;

#define FILE "hashuri"

#define INF 1023456789
#define ll long long

#ifdef FILE
	ifstream f(string (string(FILE) + ".in").c_str());
	ofstream g(string (string(FILE) + ".out").c_str());
#endif
#ifndef FILE
	#define f cin
	#define g cout
#endif

map <int, bool> mp;
int i, j, n, m, x, y;
int v[18];

#define NMOD 1999999973


int main() {

	f >> n;

	while (n--) {
		f >> x >> y;
		if (x==1 && mp.find(y) == mp.end()) {
			mp[y] = 1;
		} else if (x==2) {
			mp.erase(y);
		} else if (x==3) {
			if (mp.find(y) != mp.end()) {
				g << 1 << e;
			} else {
				g << 0 << e;
			}
		}
	}

}