Cod sursa(job #1021263)

Utilizator RobertSSamoilescu Robert RobertS Data 3 noiembrie 2013 16:23:55
Problema Hashuri Scor 0
Compilator cpp Status done
Runda Arhiva educationala Marime 0.52 kb
#include<iostream>
#include<fstream>
using namespace std;

#define MAX_N 1000001

bool hash[MAX_N];
int n;

int main(){
    ifstream fin("hashuri.in");
    ofstream fout ("hashuri.out");
    fin >> n;
    int cmd, x;
    for(int i=1; i<=n; i++){
        fin >> cmd >> x;
        if(cmd == 1){
            hash[x] = true;
        }else if(cmd == 2){
            hash[x] = false;
        }else{
            if(hash[x]) fout << 1 << '\n';
            else fout << 0 << '\n';
        }
    }

return 0;
}