input() s = [0] * 101 for a, b in zip(map(int, input().split()), map(int, input().split())): s[b] += a print('YES' if s[0] == max(s) else 'NO')