fork download
  1. #include <iostream>
  2. using namespace std;
  3. #include <bits/stdc++.h>
  4. void start()
  5. {
  6. ios_base::sync_with_stdio(0);
  7. cin.tie(0);
  8. cout.tie(0);
  9. }
  10. int main()
  11. {
  12.  
  13. start();
  14. int n, q;
  15. cin >> n >> q;
  16. int arr[n];
  17. bool fir = true;
  18. for (int i = 0; i < n; i++)
  19. cin >> arr[i];
  20. while (q--)
  21. {
  22. int res;
  23. int l, r;
  24. cin >> l >> r;
  25. for (int i = 0; i < n; i++)
  26. {
  27.  
  28. if ((i < l - 1 || i > r - 1) && fir)
  29. {
  30. res = arr[i];
  31. fir = false;
  32. }
  33. else if (i < l - 1 || i > r - 1)
  34. {
  35. res = res ^ arr[i];
  36. }
  37. }
  38. cout << res << "\n";
  39. }
  40.  
  41. return 0;
  42. }
Success #stdin #stdout 0.01s 5436KB
stdin
Standard input is empty
stdout
Standard output is empty