fork download
  1.  
  2. // Online IDE - Code Editor, Compiler, Interpreter
  3.  
  4. #include<iostream>
  5. #include <algorithm>
  6. #include <vector>
  7.  
  8. using namespace std;
  9.  
  10. int main()
  11. {
  12. int n,m;
  13. cin>>n>>m;
  14. vector<int> v1(n);
  15. vector<int> v2(m);
  16. for(int i = 0; i < n; i++){
  17. cin>>v1[i];
  18. }
  19.  
  20. for(int j = 0; j < m; j ++){
  21. cin>>v2[j];
  22. }
  23.  
  24. vector<int> ans;
  25. for(int i = 0; i < v1.size(); i++){
  26. for(int j = 0; j < v2.size(); j++){
  27. int x = v1[i] ^ v2[j];
  28. ans.push_back(x);
  29. }
  30. }
  31.  
  32. int left=0,right = left + 1;
  33. int final = 0;
  34. while(right < ans.size()){
  35. final ^= (ans[left] ^ ans[right]);
  36. left++;
  37. right++;
  38. }
  39.  
  40. cout<<final<<endl;
  41.  
  42. }
  43.  
Success #stdin #stdout 0s 5292KB
stdin
3 4
2 1 3
10 2 5 0
stdout
11