Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
134778 | 沈梓珺 | 双关键字排序 | C++ | 通过 | 100 | 404 MS | 1032 KB | 418 | 2024-03-02 17:34:16 |
#include<bits/stdc++.h> using namespace std; int n; struct stu{ int a,b; }s[110000]; 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; } return true; } return true; } int main(){ 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; }