正文
增加 4 行删除 4 行
57 行未改动58596061626364656667686970717273747576777 行未改动57 行未改动while(cin >> n) {ans = 0;memset(a, 0, sizeof(a));priority_queue <cmp> que;for(int i = 1; i <= n; ++i) scanf("%d %d", &a[i].val, &a[i].day);sort(a + 1, a + 1 + n);//按时间从小到大排序for(int i = 1; i <= n; ++i) {if(a[i].day > que.size()) que.push((cmp) {a[i].val});else if(a[i].day == que.size() && a[i].val > que.top().val) {que.pop();que.push((cmp) {a[i].val});}}while(!que.empty()) {ans += que.top().val;que.pop();}7 行未改动57 行未改动58596061626364656667686970717273747576777 行未改动57 行未改动while(cin >> n) {ans = 0;memset(a, 0, sizeof(a));priority_queue <cmp> que;for(int i = 1; i <= n; ++i) scanf("%d %d", &a[i].val, &a[i].day);sort(a + 1, a + 1 + n);//按时间从小到大排序for(int i = 1; i <= n; ++i) {if(a[i].day > que.size()) que.push((cmp) {a[i].val});else if(a[i].day == que.size() && a[i].val > que.top().val) {que.pop();que.push((cmp) {a[i].val});}}while(!que.empty()) {ans += que.top().val;que.pop();}7 行未改动