#include using namespace std; int main() { int N; cin >> N; vector score(101), a(100); for (int i = 0; i < N; i++) { cin >> a[i]; } for (int i = 0; i < N; i++) { int b; cin >> b; score[b] += a[i]; } cout << ((*max_element(score.begin(), score.end()) <= score[0]) ? "YES" : "NO") << endl; }