Pagini recente » Cod sursa (job #375151) | Cod sursa (job #1325779) | Cod sursa (job #1471418) | Cod sursa (job #1621197) | Cod sursa (job #2893977)
#include <stdio.h>
#include <fstream>
using namespace std;
//ifstream fin("hasuri.in");
//ofstream fout ("hasuri.out");
int N, multime[100], l=0;
int gaseste(int x){
for(int i=0; i<l; i++)
if (multime[i]==x)
return i;
return 0;
}
void inserare(int x){
if(gaseste(x) == 0)
multime[l+1] = x;
}
inline void stergere(int x)
{
if (gaseste(x)!=0)
for (int i = gaseste(x); i<l; i++)
multime[i] = multime[i+1];
l = l-1;
}
int main() {
int op, x;
freopen("hashuri.in", "r", stdin);
freopen("hashuri.out", "w", stdout);
for (scanf("%d", &N); N > 1; N--) {
scanf("%d %d", &op, &x);
if (op == 1)
inserare(x);
if (op == 2)
stergere(x);
if (op == 3)
printf("%d\n", gaseste(x) != 0);
}
return 0;
}