Pagini recente » Cod sursa (job #1296136) | Monitorul de evaluare | Cod sursa (job #396983) | Cod sursa (job #451668) | Cod sursa (job #2626440)
#include <fstream>
#include <vector>
using namespace std;
const int Mod = 666013;
ifstream cin("hashuri.in");
ofstream cout("hashuri.out");
vector < int > Hash[Mod];
int main() {
int n = 0;
cin >> n;
for(int i = 1; i <= n; ++i) {
int type = 0, x = 0;
cin >> type >> x;
if(type == 1) {
int ok = 0;
for(vector < int > :: iterator it = Hash[x % Mod].begin(); it != Hash[x % Mod].end(); ++it) {
if(*it == x) {
ok = 1;
break;
}
}
if(ok == 0) {
Hash[x % Mod].push_back(x);
}
}
if(type == 2) {
for(vector < int > :: iterator it = Hash[x % Mod].begin(); it != Hash[x % Mod].end(); ++it) {
if(*it == x) {
*it = -1;
break;
}
}
}
if(type == 3) {
int ok = 0;
for(vector < int > :: iterator it = Hash[x % Mod].begin(); it != Hash[x % Mod].end(); ++it) {
if(*it == x) {
ok = 1;
break;
}
}
cout << ok << "\n";
}
}
return 0;
}