Advertisement
madidino

Untitled

Nov 20th, 2022
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. int main()
  6. {
  7.  
  8. int n;
  9. cin>>n;
  10. vector<pair<int,int> > v; //nr si contorul
  11. vector<string> chr(n);
  12. for(int i=1; i<=n; i++)
  13. {
  14. int e;
  15. cin>>e;
  16. cin>>chr[e];
  17. }
  18. // vector<vector<int>> a(n,3);
  19. // for(int i=1;i<=n;i++)
  20. // {
  21. // for(int j=1;j<=3;j++)
  22. // {
  23. // cin>>a[i][j];
  24. // }
  25. // }
  26. for(int i=1; i<=n/2; i++)
  27. {
  28. int a,b,c;
  29. cin>>a>>b>>c;
  30. v[i].first=c;
  31. }
  32. int k=n/2;
  33. while(k>=4)
  34. {
  35. for(int i=1; i<=k; i++)
  36. {
  37. int a,b,c;
  38. cin>>a>>b>>c;
  39. v[i].second=v[c].first;
  40. }
  41. for(int i=1; i<=k; i++)
  42. {
  43. v[i].first=v[i].second;
  44. }
  45. k/=2;
  46. }
  47. int a1,b1,c1,a2,b2,c2,a3,b3,c3,a4,b4,c4;
  48. cin>>a1>>b1>>c1;
  49. v[1].second=c1;
  50. cin>>a2>>b2>>c2;
  51. v[2].second=c2;
  52. cin>>a3>>b3>>c3;
  53. cin>>a4>>b4>>c4;
  54. cout<<"1 "<<chr[v[c4].first]<<endl;
  55. if(b4!=c4)
  56. {
  57. cout<<"2 "<<chr[v[b4].first]<<endl;
  58. }
  59. else
  60. {
  61. cout<<"2 "<<chr[v[a4].first]<<endl;
  62. }
  63.  
  64. if(c3==1)
  65. {
  66. if(a1!=v[1].first)
  67. {
  68. cout<<"3 "<<chr[v[a1].first];
  69. }
  70. else
  71. {
  72. cout<<"3 "<<chr[v[b1].first];
  73. }
  74. }
  75. else
  76. {
  77. if(a2!=v[2].first)
  78. {
  79. cout<<"3 "<<chr[v[a2].first];
  80. }
  81. else
  82. {
  83. cout<<"3 "<<chr[v[b2].first];
  84. }
  85. }
  86.  
  87.  
  88. // for(int i=1;i<=4;i++)
  89. // {
  90. // cout<<v[i].first<<" "<<v[i].second;
  91. // }
  92.  
  93. return 0;
  94. }
  95.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement