#include #include #include #include #include #include using namespace std; int main() { int *a, b[101]; int n; cin >> n; a = new int[n]; for (int i = 0; i < n; ++i) { cin >> a[i]; } for (int i = 0; i < n; ++i) { int tmp; cin >> tmp; int testA = a[i]; b[tmp] += testA; } string result = "YES"; for (int i = 1; i <= 100; ++i) { if (b[0] < b[i]) { result = "NO"; break; } } cout << result << endl; return 0; }