Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
127608 秦炜杰 救援顺序 C++ 解答错误 90 16 MS 1808 KB 458 2024-01-25 09:39:13

Tests(9/10):


#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(){ 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; }


测评信息: