Submission #2871137


Source Code Expand

from bisect import *

def read():
  return int(input())

def reads():
  return [int(x) for x in input().split()]

N = read()
A = reads()
B = reads()

D = 28
xor = 0
for d in range(D + 1):
  mask = (1 << (d + 1)) - 1 # [1] * (d+1)
  BB = sorted(x & mask for x in B)
  count = 0
  for a in (x & mask for x in A):
    count += bisect_left(BB, (1 << (d + 1)) - a) - bisect_left(BB, (1 << d) - a)
    count += bisect_left(BB, (1 << (d + 2)) - a) - bisect_left(BB, (1 << d) + (1 << (d + 1)) - a)
  if count & 1:
    xor |= 1 << d

print(xor)

Submission Info

Submission Time
Task D - Two Sequences
User ukikagi
Language PyPy3 (2.4.0)
Score 0
Code Size 563 Byte
Status TLE
Exec Time 3161 ms
Memory 126212 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 500
Status
AC × 4
AC × 8
TLE × 8
Set Name Test Cases
Sample example_0, example_1, example_2, example_3
All N100000_0, N100000_1, N150000_0, N150000_1, N200000_0, N200000_1, N200000_ex_0, N200000_ex_1, example_0, example_1, example_2, example_3, rand_0, rand_1, smallrand_0, smallrand_1
Case Name Status Exec Time Memory
N100000_0 TLE 3160 ms 100496 KB
N100000_1 TLE 3160 ms 106220 KB
N150000_0 TLE 3160 ms 119372 KB
N150000_1 TLE 3161 ms 120272 KB
N200000_0 TLE 3161 ms 126084 KB
N200000_1 TLE 3161 ms 126212 KB
N200000_ex_0 TLE 3161 ms 126212 KB
N200000_ex_1 TLE 3161 ms 126084 KB
example_0 AC 163 ms 38256 KB
example_1 AC 165 ms 38384 KB
example_2 AC 165 ms 38512 KB
example_3 AC 163 ms 38256 KB
rand_0 AC 564 ms 54232 KB
rand_1 AC 870 ms 53472 KB
smallrand_0 AC 171 ms 38384 KB
smallrand_1 AC 166 ms 38384 KB