/* -*- coding: utf-8 -*- * * 1570.cc: No.1570 Blocks - yukicoder */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; /* constant */ const int MAX_N = 100000; /* typedef */ typedef long long ll; typedef pair pii; /* global variables */ pii ps[MAX_N]; /* subroutines */ /* main */ int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) { int a, b; scanf("%d%d", &a, &b); ps[i] = pii(a + b, b); } sort(ps, ps + n); ll sum = 0; for (int i = 0; i < n; i++) { if (sum > ps[i].second) { puts("No"); return 0; } sum += ps[i].first - ps[i].second; } puts("Yes"); return 0; }