Pagini recente » Cod sursa (job #164934) | Cod sursa (job #553371) | Cod sursa (job #1777351) | Cod sursa (job #722927) | Cod sursa (job #1777967)
#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;
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;
if (ok == 1)
fout << 1 << '\n';
else
fout << 0 << '\n';
}
}
fin.close();
fout.close();
return 0;
}