Cod sursa(job #2173674)

Utilizator infomaxInfomax infomax Data 15 martie 2018 23:29:01
Problema Hashuri Scor 100
Compilator cpp Status done
Runda Arhiva educationala Marime 0.72 kb
#include <bits/stdc++.h>

#define BUFFSIZE 1<<17

using namespace std;

FILE *F=fopen("hashuri.in", "r"), *G=fopen("hashuri.out", "w");

int n, q, x, ok;
unordered_map<int, int>m;
char buf[BUFFSIZE];
int pos=BUFFSIZE;

inline char nxt(){
    if(pos==BUFFSIZE){
        fread(buf, 1, BUFFSIZE, F);
        pos=0;
    }
    return buf[pos++];
}

inline int read(){
    int nr=0;
    char ch=nxt();
    while(!isdigit(ch)) ch=nxt();
    while(isdigit(ch)) nr=nr*10+ch-'0', ch=nxt();
    return nr;
}

int main()
{
    n=read();
    while(n--){
        q=read();
        x=read();
        if(q==1) m[x]=1;
        else if(q==2) m[x]=0;
        else fprintf(G, "%d\n", m[x]);
    }
    return 0;
}