OPiMedia

BattleDev November 26, 2020: Question 4

Nov 28th, 2020
951
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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.  
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×