n=int(input())
f=lambda:map(int,input().split())
*a,=f()
*b,=f()
s=[0]*101
for i in range(n):
	s[b[i]]+=a[i]
print('YNEOS'[s[0]<max(s)::2])