题解 | #小白鼠排队#
小白鼠排队
https://www.nowcoder.com/practice/27fbaa6c7b2e419bbf4de8ba60cf372b
#include <bits/stdc++.h> using namespace std; struct node{ int weight; string color; friend bool operator<(node n1,node n2) { return n1.weight < n2.weight; } }; int main(){ int n; while(cin>>n){ priority_queue<node> q; while(n--){ node tmp; cin>>tmp.weight>>tmp.color; q.push(tmp); } while (q.size()>0) { cout<<q.top().color<<endl; q.pop(); } } return 0; }