Cod sursa(job #1795792)

Utilizator mihai.alphamihai craciun mihai.alpha Data 2 noiembrie 2016 20:54:52
Problema Hashuri Scor 70
Compilator cpp Status done
Runda Arhiva educationala Marime 0.62 kb
#include <bits/stdc++.h>

using namespace std;

unordered_map<int,int>hash1;
FILE *fin, *fout;
void desch()  {
    fin = fopen("hashuri.in", "r");
    fout = fopen("hashuri.out", "w");
}
void inch()  {
    fclose(fin);
    fclose(fout);
}
int main()  {
    desch();
    int n;
    fscanf(fin, "%d", &n);
    int i;
    for(i = 0;i < n;i++)  {
        int op, x;
        fscanf(fin, "%d%d", &op, &x);
        if(op == 1)  {
            hash1[x] = 1;
        }
        if(op == 2)  {
            hash1[x] = 0;
        }
        if(op == 3)  {
            fprintf(fout, "%d\n", hash1[x]);
        }
    }
    inch();
    return 0;
}