Pagini recente » Cod sursa (job #2959147) | Cod sursa (job #2180807) | Cod sursa (job #3120899) | Cod sursa (job #1514900) | Cod sursa (job #2624141)
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
ifstream f("hashuri.in");
ofstream g("hashuri.out");
vector<int> hasht[66013];
void Add(int x){
hasht[x % 66013].push_back(x);
}
void Delete(int x){
int m = x % 66013;
for (int i = 0; i < hasht[m].size(); i++)
if(hasht[m][i] == x)
hasht[m].erase(hasht[m].begin()+i);
}
int Search(int x){
int m = x % 66013;
for (int i = 0; i < hasht[m].size(); i++)
if(hasht[m][i] == x)
return 1;
return 0;
}
int main()
{
int n, x, y;
f>>n;
for(; n; n--){
f >> x >> y;
if(x == 1)
Add(y);
else
if(x == 2)
Delete(y);
else
g << Search(y) << '\n';
}
}