solution

Emulate it with $2$ indices $0 \le i \lt n$ and $0 \le i \lt m$. $O(n + m)$.

implementation

#!/usr/bin/env python3
_ = int(input())
scores = sorted(set(map(int, input().split())))
_ = int(input())
alice = list(map(int, input().split()))
i = 0
for s in alice:
    while i < len(scores) and scores[i] <= s:
        i += 1
    print(len(scores)-i+1)