Pagini recente » Cod sursa (job #39154) | Cod sursa (job #392255) | Cod sursa (job #2932886) | Cod sursa (job #2961415) | Cod sursa (job #1643113)
#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;
#define SIZE 666013
vector<int> v[SIZE];
int main() {
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
int n, x, y;
fin >> n;
for (int i = 0; i < n; i++) {
fin >> x >> y;
int list = y % SIZE;
vector<int>::iterator it(find(v[list].begin(), v[list].end(), y));
if (x == 1) {
if (it == v[list].end())
v[list].push_back(y);
} else if (x == 2) {
if (it != v[list].end())
v[list].erase(it);
} else {
fout << (it != v[list].end()) << '\n';
}
}
}