#include "bits/stdc++.h"

using namespace std;

const char en = '\n';
using  ll =          long long;
using ull = unsigned long long;

int main(){
	cin.tie();	ios::sync_with_stdio(false);

	int n,a[100],score[101];
	fill_n(score,101,0);
	cin>>n;
	for(int i=0;i<n;i++){
		cin>>a[i];
	}
	int buf;
	for(int i=0;i<n;i++){
		cin>>buf;
		score[buf]+=a[i];
	}
	for(int i=1;i<=100;i++){
		if(score[i]>score[0]){
			cout<<"NO"<<en;
			return 0;
		}
	}
	cout<<"YES"<<en;
	return 0;
}