#include <bits/stdc++.h>
#define rep(i, ss, ee) for (int i = ss; i < ee; ++i)
using namespace std;

string solve() {
  int N, x, c = 0;
  cin >> N;
  vector<int> a(N), b(101);
  rep(i, 0, N) cin >> a[i];
  rep(i, 0, N) {
    cin >> x;
    b[x] += a[i];
  }
  rep(i, 0, 101) c = max(c, b[i]);
  if (c <= b[0]) return "YES";
  return "NO";
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << solve() << endl;
  getchar();
}