Advertisement
Dennnhhhickk

Untitled

Jan 15th, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.04 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. struct tepm{
  6. int data = 1, ind;
  7. };
  8.  
  9. struct all{
  10. int a, b, c, d;
  11. };
  12.  
  13. int main()
  14. {
  15. int n, x, y, z, w;
  16. bool bol1, bol2, bol3, bol4;
  17. cin >> n;
  18. tepm temp;
  19. vector <tepm> a, b;
  20. vector <all> k;
  21. all time;
  22. for (int i = 1; i <= n; i++){
  23. cin >> x >> y >> z >> w;
  24. time.a = x;
  25. time.b = y;
  26. time.c = z;
  27. time.d = w;
  28. k.push_back(time);
  29. bol1 = 0;
  30. bol2 = 0;
  31. bol3 = 0;
  32. bol4 = 0;
  33. for (int j = 1; j <= a.size(); j++){
  34. if (a[j - 1].ind == x){
  35. a[j - 1].data++;
  36. bol1 = 1;
  37. }
  38. if (a[j - 1].ind == y){
  39. a[j - 1].data++;
  40. bol2 = 1;
  41. }
  42. }
  43. for (int j = 1; j <= b.size(); j++){
  44. if (b[j - 1].ind == z){
  45. b[j - 1].data++;
  46. bol3 = 1;
  47. }
  48. if (b[j - 1].ind == w){
  49. b[j - 1].data++;
  50. bol4 = 1;
  51. }
  52. }
  53. if (!bol1){
  54. temp.ind = x;
  55. a.push_back(temp);
  56. }
  57. if (!bol2){
  58. temp.ind = y;
  59. a.push_back(temp);
  60. }
  61. if (!bol3){
  62. temp.ind = z;
  63. b.push_back(temp);
  64. }
  65. if (!bol4){
  66. temp.ind = w;
  67. b.push_back(temp);
  68. }
  69. }
  70. int maxi = 0, ans, ans1, ans2;
  71. for (int i = 0; i < a.size(); i++)
  72. for (int j = 0; j < b.size(); j++){
  73. ans = 0;
  74. for (z = 0; z < k.size(); z++)
  75. if (k[z].a == a[i].ind || k[z].b == a[i].ind || k[z].c == b[j].ind || k[z].d == b[j].ind)
  76. ans++;
  77. if (ans > maxi){
  78. maxi = ans;
  79. ans1 = a[i].ind;
  80. ans2 = b[j].ind;
  81. }
  82. }
  83. cout << ans1 << " " << ans2 << endl;
  84. return 0;
  85. }
  86.  
  87. /*
  88. 5
  89. 2 3 1 2
  90. 3 5 1 2
  91. 7 8 8 9
  92. 5 6 2 3
  93. 3 5 6 8
  94.  
  95.  
  96. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement