acgo题库
  • 首页
  • 题库
  • 学习
  • 天梯
  • 备赛

    竞赛

    • CSP-J/S
    • 蓝桥杯

    考级

    • GESP
    • CPA
    • 电子学会考级
  • 资讯
  • 竞赛
  • 讨论
  • 团队
  • 商城
登录
注册
题目详情提交记录(0)
  • 在线等!急!

    用了结构体排序,为什么1号和2号测试点会wa?在线等!急!下附代码:

    userId_undefined
    哈基米
    出道萌新
    121阅读
    6回复
    2点赞
  • 不知哪错

    #include<bits/stdc++.h> using namespace std; struct yg{ int y, s, x, z; }p[1000000]; bool cmp(yg a, yg b){ if(a.x != b.x)return a.x > b.x; else if(a.z != b.z) return a.z < b.z; else if(a.s != b.s) return a.s < b.s; else return a.y < b.y; } int main(){ int n; cin >> n; for(int i = 1; i <= n; i++){ cin >> p[i].y >> p[i].s >> p[i].x >> p[i].z; } sort(p + 1, p + n + 1, cmp); for(int i = 1; i <= n; i++){ cout << p[i].y << " "; } return 0; }

    userId_undefined
    135****6021
    分支·分支解题者
    0阅读
    0回复
    0点赞
暂无数据

提交答案之后,这里将显示提交结果~

首页