#include <bits/stdc++.h>
using namespace std;
int p[101];

int main() {
  int n;
  cin >> n;
  int a[n], b[n];
  for (auto& e : a) cin >> e;
  for (auto& e : b) cin >> e;
  for (int i = 0; i < n; i++) {
    p[b[i]] += a[i];
  }
  bool f = true;
  for (int i = 1; i < 101; i++) {
    if (p[0] < p[i]) {
      f = false;
      break;
    }
  }
  cout << (f ? "YES" : "NO") << endl;
  return 0;
}