#include<iostream> #include<algorithm> using namespace std; struct stu{ int id; int score; }; bool cmp(stu a,stu b){ return a.id<b.id; } int main(){ int n,m; cin>>n>>m; struct stu a[n+m]; for(int i=0;i<n+m;i++){ cin>>a[i].id>>a[i].score; } sort(a,a+n+m,cmp); for(int i=0;i<n+m;i++){ cout<<a[i].id<<" "<<a[i].score<<'\n'; } } |
Double click to view unformatted code.