此题有一个大坑id范围为1e9
此题题意是按照同类按照价格大小从大到小输出,如果价格相等再按照id从小到大输出。
#include
using namespace std;
struct node{int id;int score;int type;int sell;bool friend operator <(node a,node b){if(a.score !&#61; b.score) return a.score > b.score;else if(a.type !&#61; b.type) return a.type };map mp1;
set s;int n,m;
int main()
{//ios::sync_with_stdio(0);cin >> m >> n;for(int i &#61; 0;i > temp.id >> temp.score;for(int j &#61; 0;j // long long xx &#61; temp.type * 1e9 &#43; temp.id;
// mp1[xx] &#61; temp;s.insert(temp);}}int num;cin >> num;while(num--){int opt;cin >> opt;if(opt &#61;&#61; 1){int type;cin >> type;node temp;cin >> temp.id >> temp.score;temp.type &#61; type;
// long long xx &#61; temp.type * 1e9 &#43; temp.id;
// mp1[xx] &#61; 1;s.insert(temp);}else if(opt &#61;&#61; 2){int type;cin >> type;int id;cin >> id;long long xx &#61; type * 1e9 &#43; id;mp1[xx] &#61; 1;}else if(opt &#61;&#61; 3){int k;cin >> k;vector g2;//int sum &#61; 0;for(int i &#61; 0;i > t;g2.push_back(t);//sum &#43;&#61; t;}vector ans[55];int p &#61; k;
// cout <<"商品:" <// for(set::iterator it &#61; s.begin();it !&#61; s.end();it&#43;&#43;){
//
// node temp &#61; *it;
// cout <// }for(set::iterator it &#61; s.begin();it !&#61; s.end();it&#43;&#43;){node temp &#61; *it;int type &#61; temp.type;long long xx &#61; temp.type * 1e9 &#43; temp.id;if(mp1.find(xx) !&#61; mp1.end()) continue;if(g2[type] > 0){p--;g2[type]--;ans[type].push_back(temp.id);//sum--;}//if(sum &#61;&#61; 0) break;if(p &#61;&#61; 0) break;}for(int i &#61; 0;i }