Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
127547 | 马佳琪 | 排名次 | C++ | 解答错误 | 0 | 6 MS | 280 KB | 661 | 2024-01-25 09:27:19 |
#include <bits/stdc++.h> using namespace std; struct s{ int score; int id; bool operator < (const s &o){ if(score == o.score) return score=o.score; if(score != o.score) return score>o.score; } }a[1505],b[1505]; int main() { int n; cin>>n; for(int i=1;i<=n;i++) { cin>>a[i].score; b[i].score=a[i].score; } sort(b+1,b+1+n); for(int j=1;j<=n;j++) b[j].id=j; for(int k=1;k<=n;k++) { for(int d=1;d<=n;d++){ if(b[k].score==a[d].score) a[d].id=b[k].id; } } for(int l=1;l<=n;l++) cout<<a[l].score<<" "<<a[l].id<<endl; return 0; }