#include
#include
#include
#include
#include
using namespace std;
int main() {
list<pair
int n, m;
int i;
int grade, number;//number是学号
cin >> n >> m;
for (i = 0; i < n; i++) {
cin >> number >> grade;
l1.push_back(make_pair(number,grade));
}
for (i = 0; i < m; i++) {
cin >> number >> grade;
l2.push_back(make_pair(number, grade));
}
auto cmp = [](pair
return pr1.first < pr2.first;
};//lambda表达式
l1.sort(cmp);
l2.sort(cmp);
l1.merge(l2, cmp);//把l2合并到l1链表,由cmp给出排序方式
for (list<pair
cout << (*it).first << " " << (*it).second << endl;
}//用迭代器输出链表
return 0;
}
0.0分
1 人评分