Pagini recente » Cod sursa (job #2344650) | Cod sursa (job #7206) | Cod sursa (job #1668970) | Cod sursa (job #2170663) | Cod sursa (job #2887146)
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
#define k 666013
vector <int> has[k];
int main()
{int n, c, x, gasit, i, j;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
f >> n;
for(i = 0; i < n; i++)
{
f >> c >> x;
gasit = 0;
for(j = 0; j < has[x % k].size() && !gasit; j++)
if(has[x % k][j] == x)
{
gasit = 1;
if(c == 2)
{
swap(has[x % k][j], has[x % k][has[x % k].size() - 1]);
has[x % k].pop_back();
}
if(c == 3) g << 1 << '\n';
}
if(!gasit && c == 1) has[x % k].push_back(x);
if(!gasit && c == 3) g << 0 << '\n';
}
f.close();
g.close();
return 0;
}