为啥pypy会爆内存啊

P2249 【深基13.例1】查找

wyzkeyy @ 2024-03-20 00:02:47

n, m = map(int, input().split())
a = list(map(int, input().split()))
q = list(map(int, input().split()))
for qi in q:
    l, r = 0, n-1
    while l < r:
        mid = (l+r)//2
        if a[mid] >= qi:
            r = mid
        else:
            l = mid + 1
    if a[l] != qi:
        res = -1
    else:
        res = l+1
    print(res, end = " ")
print()

|