View Code of Problem 83

#include<iostream>
#include<algorithm>
using namespace std;

struct Student{
	int id;
	int grade;
};

bool cmp(Student stu1,Student stu2){
	return stu1.id<stu2.id;
}

int main(){
	int n;
	int m;
	cin>>n>>m;
	Student stu[n+m];
	for(int i=0;i<n+m;++i){
		cin>>stu[i].id>>stu[i].grade;
	}
	sort(stu,stu+n+m,cmp);
	for(int i=0;i<n+m;++i){
		cout<<stu[i].id<<" "<<stu[i].grade<<endl;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 83