Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
127629 | 秦炜杰 | 救援顺序 | C++ | 解答错误 | 90 | 21 MS | 8068 KB | 483 | 2024-01-25 09:43:18 |
#include<bits/stdc++.h> using namespace std; int n,t; struct hole{ int people; int num; }h[1000010]; bool cmp(hole x,hole y){ if(x.people!=y.people) return x.people>y.people; return x.num<y.num; } int main(){ memset(h,0,sizeof(h)); cin>>n; for(int i=1;i<=n;i++){ cin>>t; h[t].people++; h[t].num=t; } sort(h+1,h+1+n,cmp); int cnt=1; while(1){ cout<<h[cnt].num; if(h[cnt+1].people==0) return 0; cout<<"->"; cnt++; } return 0; }