python3求调 样例能过,提交就4个RE和2个TLE
查看原帖
python3求调 样例能过,提交就4个RE和2个TLE
1356218
Chen_Yu_Wei楼主2024/8/15 19:16
n,m = map(int,input().split())
l1 = list(map(int,input().split()))
l2 = list(map(int,input().split()))
x = []

for i in l2:
    s = len(l1)//2
    x = [s]
    while 1:
        if i==l1[s]:
            while i==l1[s]:
                s -= 1
            print(s+2,end=' ')
            break
        elif i<l1[s]:
            s = s//2
        else:
            s = s+s//2

        if s in x:
            print(-1,end=' ')
            break

        x.append(s)

2024/8/15 19:16
加载中...