Pagini recente » Cod sursa (job #55487) | Cod sursa (job #134505) | Infoarena Monthly 2014 - Runda 9, Solutii | Cod sursa (job #2748731) | Cod sursa (job #529531)
Cod sursa(job #529531)
#include <iostream>
#include <fstream>
#include <algorithm>
#include <vector>
using namespace std;
const char iname[] = "hashuri.in";
const char oname[] = "hashuri.out";
const int mod = 102356;
ifstream fin(iname);
ofstream fout(oname);
vector<int> H[mod];
int n, i, operation, x;
int main()
{
fin >> n;
for(i = 1; i <= n; i ++)
{
fin >> operation >> x;
if(operation == 1)
if(find(H[x % mod].begin(), H[x % mod].end(), x) == H[x % mod].end())
H[x % mod].push_back(x);
if(operation == 2)
if(find(H[x % mod].begin(), H[x % mod].end(), x) != H[x % mod].end())
{
vector<int>::iterator it = find(H[x % mod].begin(), H[x % mod].end(), x);
H[x % mod].erase(it);
}
if(operation == 3)
{
if(find(H[x % mod].begin(), H[x % mod].end(), x) == H[x % mod].end())
fout << "0\n";
else
fout << "1\n";
}
}
return 0;
}