N=int(input()) Z=lambda:list(map(int,input().split())) A=Z() B=Z() K=0 C=[0]*101 for i in range(N): if B[i]>0:C[B[i]]+=A[i] else:K+=A[i] print("YNEOS"[max(C)>K::2])