Pagini recente » Monitorul de evaluare | Cod sursa (job #1023645) | Cod sursa (job #1171331) | Cod sursa (job #2013351) | Cod sursa (job #2107614)
#include <iostream>
#include <fstream>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
int n;
bool findx(int x, int i, int q[1000000], int w[1000000])
{
bool ok1=false, ok2=false;
for(int j=i-1; j>=0; j--)
{
if(w[j]==x)
if(q[j]==1) {ok1=true; break;}
else if(q[j]==2) {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])
{
if(q[i]==3) fout<<findx(w[i], i, q, w)<<'\n';
i++;
}
}
int main()
{
read();
}