Пожалуйста, подпишитесь на официальный канал Codeforces в Telegram по ссылке https://t.me/codeforces_official. ×

Блог пользователя hars123

Автор hars123, история, 6 лет назад, По-английски

Substring Xor

Can someone explain me the detailed method about how to use tries and binary search to solve this problem.

  • Проголосовать: нравится
  • -6
  • Проголосовать: не нравится

»
6 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Let's solve another problem: you are given an array, for each pair of indexes you compute a[j] ^ a[i] and you need to find the k-th element among computed values. You can find the solution here, problem F.

How, how to solve our problem? Let's compute auxiliary array b. b[j] = a[0] ^ a[1] ^ ... ^ a[j]. Notice that now we need to solve previous problem