Pagini recente » Cod sursa (job #2528394) | Cod sursa (job #2233441) | Cod sursa (job #2578343) | Cod sursa (job #494292) | Cod sursa (job #2249449)
#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;
#define MOD 666013
vector<int> v[MOD];
int main()
{
int t;
f >> t;
while (t)
{
t--;
int op, x;
f >> op >> x;
int index = x%MOD;
vector<int>::iterator it = find(v[index].begin(), v[index].end(), x);
switch (op)
{
case 1:
{
if (it == v[index].end())
{
v[index].push_back(x);
}
} break;
case 2:
{
if (it != v[index].end())
{
*it = v[index][v[index].size() - 1];
v[index].pop_back();
}
} break;
case 3:
{
cout << (it != v[index].end()) << '\n';
} break;
}
}
return 0;
}