Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
129046 B班---刘鸿晖 救援顺序 C++ 解答错误 90 19 MS 4152 KB 489 2024-01-26 15:56:45

Tests(9/10):


#include<bits/stdc++.h> using namespace std; long long a[100005]; struct s{ long long gs,zhi; }b[10000005]; bool cmp(s x,s y){ if(x.gs!=y.gs){ return x.gs>y.gs; } else{ return x.zhi<y.zhi; } } int main(){ long long n; cin>>n; for(int i=1;i<=n;i++){ cin>>a[i]; b[a[i]].zhi=a[i]; b[a[i]].gs++; } sort(b+1,b+n+1,cmp); cout<<b[1].zhi; for(int i=2;;i++){ if(b[i].gs==0){ break; } else{ cout<<"->"<<b[i].zhi; } } return 0; }


测评信息: