#include using namespace std; int main(void) { int i, n, a[105], b[105], c[105] = { 0 }, ans = 0; cin >> n; for (i = 0; i < n; i++)cin >> a[i]; for (i = 0; i < n; i++)cin >> b[i]; for (i = 0; i < n; i++) { c[b[i]] += a[i]; } for (i = 1; i < 101; i++){ if (c[0] < c[i])ans = 1; } if (ans != 0)cout << "NO" << endl; else cout << "YES" << endl; return 0; }