Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
134768 | 沈梓珺 | 双关键字排序 | C++ | 解答错误 | 0 | 44 MS | 336 KB | 383 | 2024-03-02 17:31:03 |
#include<bits/stdc++.h> using namespace std; struct stu{ int a,b; }s[11000]; bool cmp(stu x,stu y){ if(x.a>y.a) return false; else if(x.a==y.a){ if(x.b>y.b){ return false; } } } int main(){ int n; cin>>n; for(int i=0;i<n;i++){ cin>>s[i].a>>s[i].b; } sort(s,s+n,cmp); for(int i=0;i<n;i++){ cout<<s[i].a<<" "<<s[i].b<<endl; } return 0; }