48 lines
1.1 KiB
Python
48 lines
1.1 KiB
Python
l_z = input()
|
|
wyniki = []
|
|
for z in range(int(l_z)):
|
|
b1 = input()
|
|
l_1 = [int(x) for x in input().split()]
|
|
b2 = input()
|
|
l_2 = [int(x) for x in input().split()]
|
|
|
|
wynik = []
|
|
|
|
for i in range(2):
|
|
l_1.insert(0, 0)
|
|
l_2.insert(0, 0)
|
|
|
|
if int(b2) > int(b1):
|
|
for a in range(int(b2) - int(b1)):
|
|
l_1.insert(0, 0)
|
|
|
|
if int(b1) > int(b2):
|
|
for a in range(int(b1) - int(b2)):
|
|
l_2.insert(0, 0)
|
|
|
|
ind = (len(l_1) - 1)
|
|
|
|
for x in range(int(ind)):
|
|
num_sum = (l_1[int(ind)] + l_2[int(ind)])
|
|
|
|
if num_sum == 0 or num_sum == 2:
|
|
wynik.insert(0, 0)
|
|
if num_sum == 2:
|
|
l_1[int(ind) - 1] += 1
|
|
ind -= 1
|
|
|
|
elif num_sum == 1 or num_sum == 3:
|
|
wynik.insert(0, 1)
|
|
if num_sum == 3:
|
|
l_1[int(ind) - 1] += 1
|
|
ind -= 1
|
|
|
|
while 1 in wynik and wynik[0] == 0:
|
|
del wynik[0]
|
|
if 1 not in wynik:
|
|
wynik = [0]
|
|
wyniki.append(wynik)
|
|
wynik = []
|
|
|
|
for l in range(len(wyniki)):
|
|
print(''.join(str(x) for x in wyniki[l])) |