#include #include using namespace std; int main(int argc, const char* argv[]) { int N; cin >> N; int as[N]; int bs[N]; map m; for (auto&& a : as) cin >> a; for (auto&& b : bs) cin >> b; for (int i = 0; i < N; i++) { m[bs[i]] += as[i]; } for (int i = 1; i <= 100; i++) { if (m[i] > m[0]) { cout << "NO" << endl; return 0; } } cout << "YES" << endl; return 0; }