n = int(input()) point = list(map(int, input().split())) player = list(map(int, input().split())) score = [0 for i in range(101)] for pt, pl in zip(point, player): score[pl] += pt if score[0] >= max(score[1:]): print('YES') else: print('NO')