Advertisement
Kali_prasad

quadraples whose xor is 0

Apr 19th, 2022
17
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.30 KB | None | 0 0
  1. #pragma GCC optimize ("O3")
  2. #pragma GCC target ("sse4")
  3.  
  4. #include <bits/stdc++.h>
  5. using namespace std;
  6.  
  7. typedef long long ll;
  8. typedef pair<int, int> pii;
  9. typedef pair<string,int> psi;
  10. typedef unordered_map<int,int> mii;
  11. typedef unordered_map<long long,long long> mll;
  12. typedef unordered_map<string,int> msi;
  13. typedef unordered_map<char,int> mci;
  14. typedef unordered_set<int> si;
  15. typedef unordered_set<long long> sll;
  16. typedef unordered_set<string> ss;
  17. typedef unordered_set<char> sc;
  18. typedef map<int,int> ormii;
  19. typedef map<long long,long long> ormll;
  20. typedef map<string,int> ormsi;
  21. typedef map<char,int> ormci;
  22. typedef set<int> orsi;
  23. typedef set<long long> orsll;
  24. typedef set<string> orss;
  25. typedef set<char> orsc;
  26. typedef vector<int> vi;
  27. typedef vector<string> vs;
  28. typedef vector<char> vc;
  29. typedef vector<ll> vll;
  30. typedef vector<vector<int>> vvi;
  31. typedef vector<vector<string>> vvs;
  32. typedef vector<vector<ll>> vvll;
  33.  
  34. #define FOR(i, a, b) for (auto i=a; i<=(b); i++)
  35. #define FORd(i,b,a) for (int i =b; i >= a; i--)
  36. #define sz(x) (int)(x).size()
  37. #define mp make_pair
  38. #define pb push_back
  39. #define pob pop_back
  40. #define fi first
  41. #define se second
  42. #define ins insert
  43.  
  44. const int MOD = 1000000007;
  45. //type functions here
  46.  
  47.  
  48.  
  49. int main() {
  50. ios_base::sync_with_stdio(false);
  51. cin.tie(NULL);
  52.  
  53. int tc=1;
  54. cin>>tc;
  55. FOR(w,1,tc)
  56. {
  57. vi A,B,C,D;
  58. int n;
  59. cin>>n;
  60. FOR(i,1,n)
  61. {
  62. int temp;
  63. cin>>temp;
  64. A.pb(temp);
  65. }
  66. FOR(i,1,n)
  67. {
  68. int temp;
  69. cin>>temp;
  70. B.pb(temp);
  71. }
  72. FOR(i,1,n)
  73. {
  74. int temp;
  75. cin>>temp;
  76. C.pb(temp);
  77. }
  78. FOR(i,1,n)
  79. {
  80. int temp;
  81. cin>>temp;
  82. D.pb(temp);
  83. }
  84. si s1,s2;
  85. for(auto x:A)
  86. {
  87. for(auto y:B)
  88. {
  89. s1.insert(x^y);
  90. }
  91. }
  92. for(auto x:C)
  93. {
  94. for(auto y:D)
  95. {
  96. s2.insert(x^y);
  97. }
  98. }
  99. int count=0;
  100. for(auto x:s1)
  101. {
  102. if(s2.find(x^0)!=s2.end()) count++;
  103.  
  104. }
  105. cout <<count<<endl;
  106.  
  107. }
  108. return 0;
  109. }
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement