题解 | #小白鼠排队# 利用map来快速实现
小白鼠排队
https://www.nowcoder.com/practice/27fbaa6c7b2e419bbf4de8ba60cf372b
#include <iostream>
#include<map>
#include<string>
#include <utility>
using namespace std;
int main() {
int n;
cin >> n;
map<int,string> m;
string ss;
int weight;
pair<int, string> p;
for(int i=0;i<n;i++)
{
cin >> weight >> ss;
p.first = weight;
p.second = ss;
m.insert(p);
}
for(auto i=m.rbegin(); i!=m.rend(); i++)
cout<<i->second << endl;
return 0;
}
// 64 位输出请用 printf("%lld")
