Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int recetas(vector <string> heladera, vector <vector <string> > libro, vector <int> &realizables)
- {
- set <string> h;
- for(const auto &i:heladera)
- h.insert(i);
- for(int i=0; i<libro.size(); i++)
- {
- bool estanTodos = true;
- for(const auto &j:libro[i])
- {
- if(h.count(j) == 0)
- {
- estanTodos = false;
- break;
- }
- }
- if(estanTodos)
- realizables.push_back(i+1);
- }
- return realizables.size();
- }
- /**
- //Funcion main auxiliar para testear
- int main()
- {
- int H, P;
- cin >> H >> P;
- vector <string> heladera(H);
- vector <vector <string> > libro(P);
- for(int i=0; i<H; i++)
- cin >> heladera[i];
- for(int i=0; i<P; i++)
- {
- int cant;
- cin >> cant;
- libro[i].resize(cant);
- for(int j=0; j<cant; j++)
- cin >> libro[i][j];
- }
- vector <int> realizables;
- int res = recetas(heladera, libro, realizables);
- cout << res << endl;
- for(int i=0; i<realizables.size(); i++)
- cout << realizables[i] << " ";
- cout << endl;
- return 0;
- }
- **/
Advertisement
Add Comment
Please, Sign In to add comment