Cod sursa(job #811395)

Utilizator ahmed.abdraboahmed.abdrabo ahmed.abdrabo Data 12 noiembrie 2012 05:10:13
Problema Hashuri Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.53 kb
#include <set>
#include <cstdio>
#include <vector>

using namespace std;

inline int next_int() {int d;scanf("%d", &d);return d;}

set<int> s;
set<int>::iterator it;

int main() {
	freopen("hashuri", "r", stdin);
	freopen("hashuri.out", "w", stdout);
	int n = next_int();
	for (int i = 0; i < n; i++) {
		int t = next_int();
		int x = next_int();
		if (t == 1) {
			s.insert(x);
		}
		if (t == 2) {
			it = s.find(x);
			if (it != s.end()) {
				s.erase(it);
			}
		}
		if (t == 3) {
			printf("%d\n", int(s.count(x)));
		}
	}
	return 0;
}