Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
102336 李承瀚 给朋友排序 C++ 运行超时 87 1001 MS 13572 KB 425 2023-09-13 13:23:23

Tests(7/8):


#include<bits/stdc++.h> using namespace std; int n=1; struct node{ string x,y; int pos; }a[50001]; map<string,int> mp; bool cmp(node x,node y){ if(mp[x.x]==mp[y.x]) return x.pos<y.pos; return mp[x.x]>mp[y.x]; } signed main(){ while(cin>>a[n].x>>a[n].y){ mp[a[n].x]++; a[n].pos=n; n++; } n--; sort(a+1,a+n+1,cmp); for(int i=1;i<=n;i++){ cout<<a[i].x<<" "<<a[i].y<<endl; } return 0; }


测评信息: