N = int(input()) As = list(map(int, input().split())) Bs = list(map(int, input().split())) points = [0] * 101 for a, b in zip(As, Bs): points[b] += a print('YES' if points[0] >= max(points) else 'NO')