import numpy as np if __name__ == "__main__": add1 = input().split() add2 = input().split() n1 = [] n2 = [] for i in range(1,len(add1)): if i % 2 == 0: n1.append(float(add1[i])) else: n1.append(int(add1[i])) for i in range(1,len(add2)): if i % 2 == 0: n2.append(float(add2[i])) else: n2.append(int(add2[i])) m = max(n1[0],n2[0]) + 1 N1 = [0 for i in range(m*2)] N2 = [0 for i in range(m*2)] N = [0 for i in range(m*2)] for i in np.arange(0,len(n1),2): x = n1[i] N1[x] = n1[i+1] for i in np.arange(0,len(n2),2): y = n2[i] N2[y] = n2[i+1] for i in range(m): N[i] = N1[i] + N2[i] for i in range(m): t = N[i] N[i] = N[m*2-i-1] N[m*2-i-1] = t K = 0 for i in range(m*2): if N[i] != 0: K = K + 1 K = str(K) for i in range(m * 2): if N[i] != 0: T = str(" ") + str(m*2-i-1) + str(" ") + str(N[i]) K = K + T print(K.rstrip())
11-29
441
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)