Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
102077 王为治 救援顺序 C++ 解答错误 20 15 MS 1036 KB 524 2023-09-12 13:23:04

Tests(2/10):


#include <bits/stdc++.h> using namespace std; struct node{ int x,p; }; bool cmp(node n1, node n2) { return n1.x > n2.x; } node a[100005]; signed main() { int n; cin >> n; int tmp; for(int i = 1; i <= 100000; i++)a[i].p = i; for(int i = 1; i <= n; i++) { cin >> tmp; a[tmp].x++; } sort(a+1,a+n+1,cmp); for(int i = 1; i <= n; i++) { //cout << a[i].p << " "; if(a[i+1].x!=0) { cout << a[i].p << "->"; } else { cout << a[i].p; break; } } return 0; }


测评信息: