#include #include #include using namespace std; bool judge(map &h) { auto bgn = h.begin(); auto end = h.end(); if (h.size() == 1) return (bgn->first == 0); for (auto itr = bgn; itr != end; itr++) { if (bgn->second < itr->second) return false; } return true; } int main(void) { std::ios::sync_with_stdio(false); std::cin.tie(0); int N; cin >> N; int cnt = 0; vector point(N); map hold; while (cnt < 2) { for (int i = 0; i < N; i++) { int n; cin >> n; if (cnt == 0) { point[i] = n; } else { hold[n] += point[i]; } } cnt++; } cout << ((judge(hold)) ? "YES" : "NO") << endl; }