Advertisement
999ms

Untitled

Mar 16th, 2022
707
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.56 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. #define all(x) begin(x),end(x)
  3.  
  4. using namespace std;
  5.  
  6.  
  7. struct T {
  8.     const vector<int>& a;
  9.    
  10.     T(const vector<int>& a) : a(a) {}
  11.    
  12.     const int* begin() {
  13.         return a.data();    
  14.     }
  15.    
  16.     const int* end() {
  17.         return a.data() + a.size();
  18.     }
  19.    
  20. };
  21.  
  22. vector<int> f(int n) {
  23.     vector<int> ans(n);
  24.     iota(all(ans), 0);
  25.     return ans;
  26. }
  27.  
  28. int main() {
  29.     int n;
  30.     cin >> n;
  31.     int ans = 0;
  32.     for (const auto& x : T(f(n))) {
  33.         ans ^= x;
  34.     }
  35.     cout << ans << '\n';
  36. }
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement