热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

CCFCSP推荐系统

此题有一个大坑id范围为1e9此题题意是按照同类按照价格大小从大到小输出,如果价格相等再按照id从小到大输出。​#includeusin

此题有一个大坑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 }

 

 

 

 


推荐阅读
author-avatar
豆豆豆
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有