Pagini recente » Cod sursa (job #716308) | Cod sursa (job #1808031) | Cod sursa (job #857904) | Cod sursa (job #2672722) | Cod sursa (job #1829758)
#include <iostream>
#include <fstream>
#include <vector>
using namespace std;
int main(){
ifstream fin("hashuri.in");
ofstream fout("hashuri.out");
int n;
const int M = 11587; //este prim
vector<int> table[M];
fin >> n;
for(int i = 0; i < n; i++){
int op, x;
fin >> op >> x;
if(op == 1){
table[x % M].push_back(x);
}else if(op == 2){
for(int i = 0; i < table[x % M].size(); i++){
if(table[x % M][i] == x){
table[x % M][i] = -1;
}
}
}else if(op == 3){
bool found = false;
for(int i = 0; i < table[x % M].size(); i++){
if(table[x % M][i] == x){
found = true;
}
}
fout << found << "\n";
}
}
fin.close();
fout.close();
return 0;
}