1 条题解
-
0
#include <bits/stdc++.h> using namespace std; struct node { int a, b; }; bool cmp(const node& A, const node& B) { if (A.b != B.b) return A.b > B.b; return A.a > B.a; } int main() { int n; cin >> n; vector<node> V(n); for (auto& v : V) cin >> v.a >> v.b; sort(begin(V), end(V), cmp); int ans = 0, l = 1, pos = 0; while (l != 0) { ans += V[pos].a; l += V[pos++].b - 1; } cout << ans; return 0; }
- 1
信息
- ID
- 16
- 时间
- 1000ms
- 内存
- 256MiB
- 难度
- 4
- 标签
- 递交数
- 30
- 已通过
- 16
- 上传者