#include #include #include #include #include #include using namespace std; int main() { int n, b; cin >> n; vector a(n, 0); vector score(101, 0); for (int i = 0; i < n; i++) { cin >> a[i]; } for (int i = 0; i < n; i++) { cin >> b; score[b] += a[i]; } bool possible = max_element(score.begin(), score.end()) == score.begin(); cout << (possible ? "YES" : "NO") << endl; return 0; }