View Code of Problem 83

#include<stdio.h>
#include<cstdlib>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<cstring>
using namespace std;
typedef long long ll;
struct node{
	int a;
	int b;
}s[100];
int cmp(node w, node e){
	   return w.a<e.a;
}
int main(){
     int n,m;
     scanf("%d%d",&n,&m);
     for(int i=0;i<n;i++){
     	scanf("%d%d", &s[i].a, &s[i].b);
	 }
	 for(int i=n;i<n+m;i++){
	 	scanf("%d%d", &s[i].a, &s[i].b);
	 }
	 sort(s,s+n+m,cmp);
	 for(int i=0;i<n+m;i++){
	 	printf("%d %d\n",s[i].a, s[i].b);
	 }
	 
	return 0;
}

Double click to view unformatted code.


Back to problem 83