Run ID 作者 问题 语言 测评结果 分数 时间 内存 代码长度 提交时间
102478 梁乃元 给朋友排序 C++ 通过 100 586 MS 20732 KB 677 2023-09-13 13:50:15

Tests(8/8):


# include <iostream> # include <algorithm> #include <map> using namespace std ; struct name { string xing , ming ; int n ; } ; name a [114514] ; map <string , int> f ; bool cmp ( name x , name y ) { if ( f [x . xing] != f [y . xing] ) { return ( f [x . xing] > f [y . xing] ) ; } return x . n < y . n ; } int main ( ) { string x , m ; int cnt = 0 ; while ( cin >> x >> m ) { cnt ++ ; a [cnt] . xing = x ; a [cnt] . ming = m ; a [cnt] . n = cnt ; f [x] ++ ; } stable_sort ( a + 1 , a + cnt + 1 , cmp ) ; for ( int i = 1 ; i <= cnt ; i ++ ) { cout << a [i] . xing << ' ' << a [i] . ming << endl ; } return 0 ; }


测评信息: