View Code of Problem 83

#include <cstdio>
#include <iostream>
#include <algorithm>

using namespace std;
struct student{
	int id;
	int grade;
};
bool cmp(student a,student b){
	return a.id<b.id;
}
int main(){
	int n,m;
	cin>>n>>m;
	int kk=n+m;
	student stu[kk];
	for(int i=0;i<kk;i++){
		cin>>stu[i].id>>stu[i].grade;
	}
	sort(stu,stu+kk,cmp);
	for(int i=0;i<kk;i++){
		cout<<stu[i].id<<" "<<stu[i].grade<<endl;
	}
}

Double click to view unformatted code.


Back to problem 83