Cod sursa(job #1030926)

Utilizator danny794Dan Danaila danny794 Data 15 noiembrie 2013 17:11:01
Problema Hashuri Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.51 kb
#include <cstdio>
#include <bitset>

#define NMAX 2000000000

using namespace std;

int N;
bitset<NMAX> set;

void read(){
	freopen("hashuri.in","r",stdin);
	freopen("hashuri.out","w",stdout);
}

void apply(int op, int x){
	switch(op){
	case(1): set[x] = 1; break;
	case(2): set[x] = 0; break;
	case(3): if (set[x] == 0)
				printf("0\n");
			else
				printf("1\n");
			break;
	}
}

int main() {
	read();
	int op, x;
	scanf("%d", &N);
	for (int i = 1; i <= N; i++){
		scanf("%d %d", &op, &x);
		apply(op, x);
	}
	return 0;
}