Advertisement
Guest User

Untitled

a guest
Feb 16th, 2019
357
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.40 KB | None | 0 0
  1. #pragma GCC optimize("Ofast")
  2. #pragma GCC optimize("no-stack-protector")
  3. #pragma GCC optimize("unroll-loops")
  4. #pragma GCC optimize("fast-math")
  5. #pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
  6. #include <stdlib.h>
  7. #include<iostream>
  8. #include<vector>
  9. #include<string>
  10. #include<algorithm>
  11. #include<cmath>
  12. #include <utility>
  13. #include <omp.h>
  14. #include<ctime>
  15. #include <map>
  16. #include<set>
  17. #include<unordered_set>
  18. #include<functional>
  19. #define int long long
  20. using namespace std;
  21.  
  22. #pragma comment(linker, "/STACK:1024000000")
  23. #pragma Gcc optimize("O3")
  24. #pragma Gcc target("sse,sse2,sse3,ssse3,sse4,popc2nt,abm,mmx,avx,tune=native")
  25. #pragma Gcc optimize("unroll-loops")
  26. #define fastio() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
  27. long long sum2 = 0;
  28. long long a, b, c = 0, odd = 0, neodd = 0, d = 0, ans = 0, x, y, xx, yy;
  29. map<long long, long long>map1, map2;
  30. vector<long long>vec;
  31. signed main()
  32. {
  33. char ch;
  34. long long dp[1002],dp2[1001], ans = 1, ans2 = 0, ans3 = 1;
  35. string s;
  36. cin >> a;
  37. map2[0]++;
  38. for (int i = 0; i < a; i++) {
  39. cin >> b;
  40. c = c ^ b;
  41. if (i % 2 == 0) {
  42. map1[c]++;
  43. }
  44. else {
  45. map2[c]++;
  46. }
  47. vec.push_back(c);
  48. }
  49. b = 0;
  50. for (int i = 0; i < vec.size(); i++) {
  51. b += map1[vec[i]] * (map1[vec[i]] - 1) / 2 + map2[vec[i]] * (map2[vec[i]] - 1) / 2;
  52. map1[vec[i]] = 0;
  53. map2[vec[i]] = 0;
  54. }
  55. cout << b;
  56. cin >> a;
  57. return 0;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement