N = int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) scores = [0]*101 for i in range(N): scores[b[i]]+=a[i] if scores[0]>=max(scores[1:]): print("YES") else: print("NO")