View Code of Problem 83

#include<stdio.h>
#include<string.h>
#include<math.h>
#include<algorithm>
using namespace std;

struct student
{
    int id;
    int source;
}list[100];

bool cmp(student a,student b)
{
    if(a.id < b.id)
        return true;
    else
    {
        return false;
    }  
}
int main()
{
   int n,m;
   scanf("%d %d",&n,&m);
   for(int i = 0;i<m+n;i++)
   {
       scanf("%d %d",&list[i].id,&list[i].source);
   }
   sort(list,list+m+n,cmp);
   for(int i =0;i<m+n;i++)
   {
       printf("%d %d\n",list[i].id,list[i].source);
   }
   return 0;
}

Double click to view unformatted code.


Back to problem 83