Pagini recente » Cod sursa (job #2755732) | Cod sursa (job #956144) | Cod sursa (job #1785097) | Cod sursa (job #2567147) | Cod sursa (job #1777969)
#include <fstream>
using namespace std;
unsigned int N;
unsigned short int op;
unsigned int x;
unsigned int V[1000001];
bool ok;
unsigned int i, j, k, start;
int main ()
{
ifstream fin ("hashuri.in");
fin >> N;
ofstream fout ("hashuri.out");
for (i=1; i<=N; i++)
{
fin >> op >> x;
if (op == 1)
{
k++;
V[k] = x;
}
else if (op == 2)
{
for (j=1; j<=k; j++)
if (V[j] == x)
{
start = j;
break;
}
for (j=start; j<=k; j++)
V[j] = V[j+1];
k--;
}
else
{
ok = 0;
for (j=1; j<=k; j++)
if (V[j] == x)
{
ok = 1;
break;
}
if (ok == 1)
fout << 1 << '\n';
else
fout << 0 << '\n';
}
}
fin.close();
fout.close();
return 0;
}