Pagini recente » Cod sursa (job #2569907) | Cod sursa (job #326264) | Cod sursa (job #563002) | Cod sursa (job #433985) | Cod sursa (job #2249438)
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
#define cout g
vector<int> v;
int main()
{
int t;
f >> t;
while (t)
{
t--;
int op, x;
f >> op >> x;
switch (op)
{
case 1:
{
v.push_back(x);
} break;
case 2:
{
vector<int>::iterator it = find(v.begin(), v.end(), x);
if (it != v.end())
{
*it = v[v.size() - 1];
v.pop_back();
}
} break;
case 3:
{
vector<int>::iterator it = find(v.begin(), v.end(), x);
cout << (it != v.end()) << '\n';
} break;
}
}
return 0;
}