Cod sursa(job #2422691)

Utilizator StefanSanStanescu Stefan StefanSan Data 19 mai 2019 17:11:11
Problema Hashuri Scor 30
Compilator cpp-64 Status done
Runda Arhiva educationala Marime 0.68 kb
#include <iostream>
#include <string.h>
#include <cmath>
#include <algorithm>
#include <fstream>
#include <vector>
#define MAX 2000000

using namespace std;

ifstream in("hashuri.in");
ofstream out("hashuri.out");

int a[MAX], n, x, y, b[MAX];

int main(){
	in >> n;
	while (n != 0) {
		n--;
		in >> x >> y;
		if (x == 1) {
			if (y >= 2000000) {
				b[y - 2000000] = 1;
			}
			else {
				a[y] = 1;
			}
		}
		if (x == 2) {
			if (y >= 2000000) {
				b[y - 2000000] = 0;
			}
			else {
				a[y] = 0;
			}
		}
		if (x == 3) {
			if (y >= 2000000) {
				out << b[y - 2000000] << endl;;
			}
			else {
				out << a[y] << endl;
			}
		}
	}


}