diff --git a/40.cpp b/40.cpp index 6b0336b..7836cfa 100644 --- a/40.cpp +++ b/40.cpp @@ -4,10 +4,6 @@ using namespace std; struct node { int w, s; - const bool operator<(const node &x) const - { - return w + s < x.w + x.s; - } } a[50005]; int main() { @@ -15,7 +11,8 @@ int main() scanf("%d", &n); for (int i = 1; i <= n; ++i) scanf("%d%d", &a[i].w, &a[i].s); - sort(a + 1, a + 1 + n); + sort(a + 1, a + 1 + n, [](node x, node y) + { return x.w + x.s < y.w + y.s; }); int tot = 0, ans = -2147483648; for (int i = 1; i <= n; ++i) {