# coding=utf-8: n = int(input()) score = list(map(int, input().split())) person_num = list(map(int, input().split())) persons = [i for i in range(101)] persons_score = [0 for i in range(101)] persons_dict = dict(zip(persons, persons_score)) for i, j in zip(score, person_num): persons_dict[j] += i if max(persons_dict.values()) <= persons_dict[0]: print("YES") else: print("NO")