Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
129047 | 罗嘉为 | 救援顺序 | C++ | 通过 | 100 | 14 MS | 260 KB | 497 | 2024-01-26 15:57:42 |
#include<bits/stdc++.h> using namespace std; struct node{ int id, x; }; const int N=1010; node a[N]; bool cmp(node x,node y){ if(x.x == y.x) return x.id < y.id; return x.x > y.x; } int main(){ int n, s; cin >> n; for(int i = 1; i < N; i++) a[i].id = i; for(int i = 1; i <= n; i++){ cin >> s; a[s].x++; } sort(a + 1, a + 1001, cmp); cout << a[1].id; for(int i = 2; i < N; i++){ if(a[i].x==0) break; else cout << "->" << a[i].id; } return 0; }