Pagini recente » Cod sursa (job #1336822) | Cod sursa (job #2870579) | Cod sursa (job #50793) | Cod sursa (job #1643003) | Cod sursa (job #1973457)
#include <stdio.h>
#include <unordered_map>
FILE *f1 = fopen("hashuri.in","r");
FILE *f2 = fopen("hashuri.out","w");
const int buff_size = 100000;
int buff_poz;
char buff[buff_size];
inline void citeste(int &x)
{
while(buff[buff_poz]<'0' || buff[buff_poz]>'9')
if(++buff_poz == buff_size)
{
buff_poz = 0;
fread(buff,1,buff_size,f1);
}
x = 0;
while(buff[buff_poz]>='0' && buff[buff_poz]<='9')
{
x = x*10 + buff[buff_poz] - '0';
if(++buff_poz == buff_size)
{
buff_poz = 0;
fread(buff,1,buff_size,f1);
}
}
}
std::unordered_map<int,bool> h;
int n,op,el;
int main()
{
citeste(n);
while(n--)
{
citeste(op);
citeste(el);
if(op == 1)
h[el] = true;
if(op == 2)
h[el] = false;
if(op == 3)
fprintf(f2,"%d\n",h[el]);
}
return 0;
}