fork download
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. using u32 = unsigned int;
  5.  
  6. const int N = 5e7;
  7.  
  8. int n;
  9. u32 seed, a[N];
  10.  
  11. inline u32 input(u32 x) {
  12. x ^= x << 13;
  13. x ^= x >> 17;
  14. x ^= x << 5;
  15. return x;
  16. }
  17.  
  18. void output() {
  19. u32 re = n;
  20. u32 x = 23333333;
  21. for (u32 i = 0; i < n; i++) {
  22. re = re ^ (a[i] + x);
  23. x ^= x << 13;
  24. x ^= x >> 17;
  25. x ^= x << 5;
  26. }
  27. cout << re << '\n';
  28. }
  29.  
  30. void solve() {
  31. cin >> n >> seed;
  32. for (int i = 0; i < n; i++) {
  33. seed = input(seed);
  34. a[i] = seed;
  35. }
  36. sort(a, a + n);
  37. output();
  38. }
  39.  
  40. int main() {
  41. solve();
  42. return 0;
  43. }
Success #stdin #stdout 0.01s 5396KB
stdin
Standard input is empty
stdout
0