#include #include #include using namespace std; #define rep(i, n) for (int i = 0; i < n; i++) #define MAX 100 int main() { map dic; int n; cin >> n; int a[MAX]; int score = 0; rep(i, n) { cin >> a[i]; score += a[i]; } rep(i, n) { int b; cin >> b; dic[b] += a[i]; score -= b == 0 ? 0 : a[i]; } string ans = "YES"; for (auto i : dic) { ans = i.second > score ? "NO" : ans; } cout << ans << endl; }