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