Pagini recente » Cod sursa (job #1674355) | Cod sursa (job #2769568) | Cod sursa (job #107613) | Cod sursa (job #2157092) | Cod sursa (job #2221333)
#include <fstream>
#include <iostream>
#include <map>
#include <vector>
using namespace std;
map<int, vector<int> > sir;
int main()
{
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
int n;
fin >> n;
int op, x, theta = 120607;
for(int i = 1; i <= n; ++i){
fin >> op >> x;
if(op == 1)
sir[x % theta].push_back(x);
if(op == 2){
for(int i = 0; i < sir[x % theta].size(); ++i){
if(sir[x % theta][i] == x){
sir[x % theta].erase(sir[x % theta].begin() + i);
break;
}
}
}
if(op == 3){
bool exista = 0;
for(int i = 0; i < sir[x % theta].size() && !exista; ++i){
if(sir[x % theta][i] == x)
exista = 1;
}
fout << exista << "\n";
}
}
return 0;
}