View Code of Problem 83

#include<bits/stdc++.h>
using namespace std;
struct stud{
	int id,grade;
};
bool cmp(stud,stud);
int main(){
	int m,n;
	cin>>m>>n;
	stud stu[1000];
	for(int i = 0;i<m;i++){
		cin>>stu[i].id>>stu[i].grade;
	}
	for(int i = m;i<m+n;i++){
		cin>>stu[i].id>>stu[i].grade;
	}
	sort(stu,stu+(m+n),cmp);
	for(int i = 0;i<m+n;i++){
		cout<<stu[i].id<<" "<<stu[i].grade;
		if(i!=m+n-1)cout<<endl;
	}
	return 0;
}
bool cmp(stud a,stud b){
	return a.id < b.id ; 
}

Double click to view unformatted code.


Back to problem 83