第一行两个整数,表示两个数组的长度, 接下来两行表示两个数字的值, 最后一行有四个整数a,b,c,d。 数组长度不会超过1000000。
每行一个整数,对应合并数组的下标在中间的那个值。
5 4 1 2 3 4 5 6 7 8 9 1 2 1 3
6
while True: try: nums = list(map(int,input().split())) array1 = list(map(int,input().split())) array2 = list(map(int,input().split())) a,b,c,d = list(map(int,input().split())) newArray = array1[a-1:b]+array2[c-1:d] #第一个是下标0 print(newArray[(len(newArray)-1)//2]) #取下标小的直接长度减一后除二 except Exception: break
while True:
try:
a=int(input())
for i in range(a):
b=input()
c=list(map(int,input().split()))
d=list(map(int,input().split()))
num1,num2,num3,num4=map(int,input().split())
res=c[num1-1:num2]+d[num3-1:num4]
length=len(res)
print(res[length//2-1] if length%2==0 else res[length//2])
except:
break
try: while 1: t = input() for i in xrange(t): n, m = map(int, raw_input().split()) N = map(int, raw_input().split()) M = map(int, raw_input().split()) a, b, c, d = map(int, raw_input().split()) result = N[a:b] + M[c:d] length = (b - a - 1) + (d - c - 1) if length % 2 != 0: print result[(length - 1) / 2] else: print result[length / 2 - 1] except: pass