#include<iostream> #include<string> #include<string.h> #include<algorithm> #include<stdio.h> #include<cmath> #include<vector> #include<utility> #include<stack> #include<queue> #include<list> #include<bitset> #define FOR(i, a, b) for(int i=(a);i<=(b);i++) #define RFOR(i, a, b) for(int i=(a);i>=(b);i--) #define MOD 1000000007 #define INF 1000000000 using namespace std; int main(void) { int n; int a[101], b[101]; int dp[102] = {}; cin >> n; FOR(i, 1, n) { cin >> a[i]; } FOR(i, 1, n) { cin >> b[i]; } FOR(i, 1, n) { FOR(t, 0, 100) { if (b[i] == t) { dp[t] += a[i]; } } } FOR(i, 1, 100) { if (dp[0] < dp[i]) { cout << "NO" << endl; break; } if (i == 100) { cout << "YES" << endl; break; } } return 0; }