Pagini recente » Cod sursa (job #1058750) | Cod sursa (job #2634018) | Cod sursa (job #2338962) | Cod sursa (job #1979885) | Cod sursa (job #2622444)
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
//const int mod = 66013;
vector<int> hasht[66013];
void add(int x){
hasht[x % 66013].push_back(x);
}
void deleteh(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 searchh(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()
{
ifstream f("hashuri.in");
ofstream g("hashuri.out");
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;
}
f.close();
g.close();
return 0;
}