Submission #3784497
Source Code Expand
import bisect
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
#a = [1, 2]
#b = [3, 4]
#a = [4, 6, 0, 0, 3, 3]
#b = [0, 5, 6, 5, 0, 3]
#a = [1, 2, 3, 4, 5]
#b = [1, 2, 3, 4, 5]
#a = [0,]
#b = [0,]
ans = 0
for i in range(1, 28):
c = 2 ** i
half_c = c // 2
temp_a = [a_num % c for a_num in a]
temp_b = [b_num % c for b_num in b]
temp_b = sorted(temp_b)
counts = 0
for a_num in temp_a:
if a_num < half_c:
bound1 = bisect.bisect_left(temp_b, half_c - a_num)
bound2 = bisect.bisect_left(temp_b, c - a_num)
counts += bound2 - bound1
elif a_num == half_c:
bound3 = bisect.bisect_left(temp_b, half_c)
counts += bound3
else:
bound4 = bisect.bisect_left(temp_b, c - a_num)
bound5 = bisect.bisect_left(temp_b, c + half_c - a_num)
counts += len(temp_b) - bound5 + bound4
if counts % 2 == 1:
ans += half_c
print(ans)
Submission Info
Submission Time |
|
Task |
D - Two Sequences |
User |
ryoryoryo111 |
Language |
PyPy3 (2.4.0) |
Score |
0 |
Code Size |
1055 Byte |
Status |
WA |
Exec Time |
3164 ms |
Memory |
131084 KB |
Judge Result
Set Name |
Sample |
All |
Score / Max Score |
0 / 0 |
0 / 500 |
Status |
|
|
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 |
3162 ms |
120848 KB |
N100000_1 |
TLE |
3161 ms |
121068 KB |
N150000_0 |
TLE |
3163 ms |
124784 KB |
N150000_1 |
TLE |
3163 ms |
123272 KB |
N200000_0 |
TLE |
3162 ms |
130956 KB |
N200000_1 |
TLE |
3162 ms |
130332 KB |
N200000_ex_0 |
TLE |
3164 ms |
127616 KB |
N200000_ex_1 |
TLE |
3163 ms |
131084 KB |
example_0 |
AC |
164 ms |
38256 KB |
example_1 |
AC |
163 ms |
38256 KB |
example_2 |
AC |
164 ms |
38256 KB |
example_3 |
AC |
164 ms |
38256 KB |
rand_0 |
WA |
447 ms |
55388 KB |
rand_1 |
WA |
635 ms |
58596 KB |
smallrand_0 |
AC |
168 ms |
38256 KB |
smallrand_1 |
AC |
168 ms |
38256 KB |