Pagini recente » Cod sursa (job #334622) | Cod sursa (job #476102) | Cod sursa (job #2209445) | Cod sursa (job #2516870) | Cod sursa (job #2107198)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
int a[1000000];
bool findx(int x, int i, int q[], int w[])
{
bool ok1=false, ok2=false;
for(int j=i-1; j>=0; j--)
{
if(q[j]==1 && w[j]==x) {ok1=true; break;}
else if(q[j]==2 && w[j]==x) {ok2=true; break;}
}
if(ok1 && !ok2) return true;
return false;
}
void read()
{
int n;
fin>>n;
int q[n], w[n];
int i=1;
while(fin>>q[i]>>w[i])
i++;
for(int i=1; i<=n; i++)
{
if(q[i]==3) fout<<findx(w[i], i, q, w)<<'\n';
}
}
int main()
{
read();
}