View Code of Problem 83

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

Double click to view unformatted code.


Back to problem 83