Advertisement
Guest User

Untitled

a guest
Dec 9th, 2019
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.88 KB | None | 0 0
  1. // Example program
  2. #include <iostream>
  3. #include <vector>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8. int k;
  9. cin >> k;
  10. int lengths[k];
  11. int totalLength = 2;
  12. int startingIndex[k];
  13. startingIndex[0] = 2;
  14. for(int i = 0; i < k; ++i)
  15. {
  16. cin >> lengths[i];
  17. totalLength += lengths[i];
  18. if(i!=0) startingIndex[i] = startingIndex[i-1] + lengths[i-1];
  19. }
  20.  
  21. for(int i = 0; i < k; ++i)
  22. {
  23. cout << "Starting index dla " << (char)(i+97) << ": " << startingIndex[i] << endl;
  24. }
  25.  
  26. int l,r,leftLength = 0,rightLength = 0;
  27. cin >> l;
  28. char leftSide[l];
  29.  
  30. for(int i = 0; i < l; ++i)
  31. {
  32. cin >> leftSide[i];
  33. if(leftSide[i] == '0' || leftSide[i] == '1')
  34. ++leftLength;
  35. else
  36. leftLength += lengths[(int)leftSide[i] - 97];
  37. }
  38. cin >> r;
  39. char rightSide[r];
  40. for(int i = 0; i < r; ++i)
  41. {
  42. cin >> rightSide[i];
  43. if(rightSide[i] == '0' || rightSide[i] == '1')
  44. ++rightLength;
  45. else
  46. rightLength += lengths[(int)rightSide[i] - 97];
  47. }
  48.  
  49. cout << leftLength << " " << rightLength;
  50.  
  51. short leftSideExpanded[leftLength];
  52. short rightSideExpanded[leftLength];
  53.  
  54. for(int j = 0; j < l; ++j)
  55. {
  56. for(int x = 0; x < lengths[(int)leftSide[j] - 97]; ++x)
  57. {
  58. leftSideExpanded[x] = (int)leftSide[j] - 97;
  59. }
  60. }
  61.  
  62. if(leftLength != rightLength)
  63. {
  64. cout << 0;
  65. return 0;
  66. }
  67.  
  68. vector<vector<int>> graph(totalLength);
  69.  
  70. for(int i = 0; i < leftLength; ++i)
  71. {
  72. // porownojemy i'ta pozycje z lewego z i'ta z prawego
  73. int lK = (int)leftSide[i] - 97, rK = (int)leftSide[i] - 97;
  74. if(leftSide[i] == '1' || rightSide[i] == '1')
  75. {
  76.  
  77. }
  78. }
  79. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement