Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
101907 | 陈志轩 | 给朋友排序 | C++ | 通过 | 100 | 801 MS | 12704 KB | 1092 | 2023-09-11 13:52:03 |
#include<bits/stdc++.h> #define int long long using namespace std; namespace Fast{ inline int fr(){ register int x = 0,f = 1; static char c = getchar(); while (c < '0' || c > '9'){ if (c == '-'){ f = -1; } c = getchar(); } while (c >= '0' && c <= '9'){ x = (x << 1) + (x << 3) + (c ^ 48); c = getchar(); } return x * f; } inline void CCF(int opt){ ios::sync_with_stdio(false); if (opt == 0){ cout.tie(0); return ; } if (opt >= 1){ cin.tie(0); } if (opt >= 2){ cout.tie(0); } } } using namespace Fast; struct N{ string a,b; int id; }s[50005]; map <string,int> mp; bool cmp(N a,N b){ if (mp[a.a] == mp[b.a]){ return a.id < b.id; } return mp[a.a] > mp[b.a]; } signed main(){ //freopen(".in","r",stdin); //freopen(".out","w",stdout); CCF(2); string o,p; int n = 0; while (cin>>o>>p){ n++; s[n].a = o,s[n].b = p; s[n].id = n; mp[o]++; } sort(s + 1,s + n + 1,cmp); for (int i = 1;i <= n;i++){ cout<<s[i].a<<' '<<s[i].b<<'\n'; } return 0; }