Pagini recente » Cod sursa (job #312149) | Cod sursa (job #833135) | Cod sursa (job #202763) | Cod sursa (job #1960819) | Cod sursa (job #2622437)
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
const int mod = 66666;
vector<int> hasht[66666];
ifstream f("hashuri.in");
ofstream g("hashuri.out");
void add(int x){
hasht[x % 66666].push_back(x);
}
void deleteh(int x){
int m = x % 66666;
for (int i = 0; i < hasht[m].size(); i++){
if(hasht[m][i] == x){
hasht[m].erase(hasht[m].begin()+i);
return;
}
}
}
int searchh(int x){
int m = x % 66666;
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(int i = 0; i < n; i++){
f >> x >> y;
if(x == 1)
add(y);
else
if(x == 2)
deleteh(y);
else
g << searchh(y) << endl;
}
return 0;
}