N = int(input().strip())
a = [int(i) for i in input().strip().split(' ')]
b = [int(i) for i in input().strip().split(' ')]

c = [0 for _ in range(101)]

for n, i in enumerate(b):
  c[i] += a[n]

if c[0] >= max(c[1:]):
  print('YES')
else:
  print('NO')