Advertisement
OPiMedia

BattleDev November 26, 2020: Question 4

Nov 28th, 2020
1,399
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.55 KB | None | 0 0
  1. #!/usr/bin/env python3
  2. # -*- coding: utf-8 -*-
  3.  
  4. """
  5. BattleDev November 26, 2020
  6. Question 4
  7. """
  8.  
  9. import sys
  10.  
  11.  
  12. def main() -> None:
  13.     n, _ = map(int, input().split())
  14.  
  15.     ys = [0]
  16.     y = 0
  17.     for x in map(int, input().split()):
  18.         y ^= x
  19.         ys.append(y)
  20.  
  21.     print(ys, file=sys.stderr)
  22.  
  23.     assert len(ys) == n + 1
  24.  
  25.     nbs = [0] * 256
  26.     for line in sys.stdin:
  27.         l, r = map(int, line.split())
  28.         nbs[ys[r + 1] ^ ys[l]] += 1
  29.  
  30.     print(' '.join(str(nb) for nb in nbs))
  31.  
  32.  
  33. if __name__ == '__main__':
  34.     main()
  35.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement