Pagini recente » Cod sursa (job #1715088) | Cod sursa (job #2700596) | Cod sursa (job #3292976) | Cod sursa (job #3286560) | Cod sursa (job #2060538)
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
int n, op, x;
const int P = 10000007;
vector<int>V[P + 1];
int main()
{
fin >> n;
for(int i = 1; i <= n; i++)
{
fin >> op >> x;
if(op == 1)
{
V[x % P].push_back(x);
}
else if(op == 2)
{
int ok =-1;
for(int j = 0; j < V[x % P].size(); j++)
if(V[x % P][j] == x)ok = j;
if(ok != -1)
V[x % P].erase(V[x % P].begin() + ok);
}
else
{
int ok =-1;
for(int j = 0; j < V[x % P].size(); j++)
if(V[x % P][j] == x)ok = j;
if(ok == -1)fout << 0 << '\n';
else fout << 1 << '\n';
}
}
return 0;
}