View Code of Problem 83

#include<stdio.h>
#include<algorithm> 
using namespace std;
typedef struct student{
	int id,score;
}stu;
bool cmp(stu a,stu b)
{
	if(a.id!=b.id)
	return a.id<b.id;
}
int main()
{
	int m,n;
	scanf("%d %d",&m,&n);
	stu c[m+n];
	for(int i=0;i<m+n;i++)
	{
		scanf("%d %d",&c[i].id,&c[i].score);
	}
	sort(c,c+m+n,cmp);
	for(int i=0;i<m+n;i++)
	{
		printf("%d %d\n",c[i].id,c[i].score);
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 83