import sys if sys.platform == 'ios': sys.stdin = open('in.txt') sys.setrecursionlimit(10**6) n=int(input()) a=list(map(int,input().split())) b=list(map(int,input().split())) m=100 c=[0]*(m+1) for i in range(n): c[b[i]]+=a[i] if c[0]>=max(c[1:m+1]): print('YES') else: print('NO')