#include using namespace std; int main() { int n; cin >> n; vector a(101, 0), b(101, 0); for(int i = 0, num; i < n; ++i) { cin >> num; a[i] = num; } for(int i = 0, num; i < n; ++i) { cin >> num; b[i] = num; } vector scores(101, 0); for(int i = 0; i < n; ++i) { scores[b[i]] += a[i]; } int me = scores.front(); for(int i = 1; i < 101; ++i) { if(me < scores[i]) { cout << "NO" << '\n'; return 0; } } cout << "YES" << '\n'; return 0; }