Advertisement
Guest User

Untitled

a guest
Mar 1st, 2015
188
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.11 KB | None | 0 0
  1. class A {
  2.  
  3. void print_state();
  4.  
  5. int *m_var;
  6. int m_Nvar;
  7.  
  8. std::vector<std::vector<std::int> > m_doms;
  9. std::vector<std::vector<std::int> > m_groups;
  10. std::vector<std::string> > m_words;
  11.  
  12. int *m_cst1;
  13. int *m_cst2;
  14. int m_Ncst;
  15.  
  16. CwordSolver::CwordSolver(std::string words[], int num,
  17. int c1[], int m, int c2[], int n) {
  18.  
  19. // we are only interested, the words of length smaller than m_max_len
  20. // put m_max_len number of empty vectors (groups) in the group vector
  21. for (int i = 0; i < m_max_len; i++)
  22. {
  23. m_groups.push_back(std::vector<int>());
  24. }
  25.  
  26. // go through every words and copy words of interest to m_words
  27. // push the index of the word to the group it belongs to (by its length)
  28. for (int i = 0, k = 0; i < num; i++, k++)
  29. {
  30. int len = words[i].length();
  31. if (len > m_max_len)
  32. continue;
  33. m_words.push_back(words[i]);
  34. m_groups[len].push_back(k);
  35. }
  36.  
  37. // you can ignore this part: link the group to another structure
  38. for (int i = 0; i < m_Nvar; i++)
  39. {
  40. m_doms.push_back(m_groups[m_cst1[i]]);
  41. }
  42.  
  43. ...
  44. }
  45.  
  46. ...
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement