n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) score=0 score0=0 for num in range(max(b)+1): for i in range(n): if b[i]==num: score+=a[i] if num==0: score0 = score else: if score > score0: print("NO") break score=0 else: print("YES")