Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
127358 马佳琪 救援顺序 C++ 运行出错 0 4 MS 272 KB 661 2024-01-25 08:49:09

Tests(0/10):


#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; }


测评信息: