n=int(input()) a=list(map(int,input().split(" "))) b=list(map(int,input().split(" "))) c=[[a[i],b[i]] for i in range(n)] my,ps=0,[0]*100 for w in c: if w[1]==0: my+=w[0] else: ps[w[1]-1]+=w[0] if my>=max(ps): print("YES") else: print("NO")