Pagini recente » Cod sursa (job #1307705) | Cod sursa (job #1246051) | Cod sursa (job #1951666) | Cod sursa (job #249612) | Cod sursa (job #1977056)
#include <cstdio>
#include <unordered_map>
using namespace std;
const int DIM=100000;
unordered_map<int,int>ap;
char buff[DIM];
int poz=DIM-1;
void citeste(int &nr)
{
nr=0;
while(!('0'<=buff[poz]&&buff[poz]<='9'))
{
if(++poz==DIM) fread(buff,1,DIM,stdin),poz=0;
}
while('0'<=buff[poz]&&buff[poz]<='9')
{
nr=nr*10 + buff[poz]-'0';
if(++poz==DIM) fread(buff,1,DIM,stdin),poz=0;
}
}
int main()
{
freopen ("hashuri.in","r",stdin);
freopen ("hashuri.out","w",stdout);
int n;
citeste(n);
for(;n>0;--n)
{
int tip,val;
citeste(tip),citeste(val);
if(tip==1) ap[val]++;
else if(tip==2&&ap[val]>0) --ap[val];
else if(tip==3)
{
if(ap[val]>0) printf("1\n");
else printf("0\n");
}
}
}