View Code of Problem 83

#include<iostream>
#include<math.h>
#include<algorithm>
#include<cstring>
using namespace std;
struct node{
	int id;
	int g;
}s[1000];
bool cmp(node x,node y){
	return x.id<y.id;
}

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

Double click to view unformatted code.


Back to problem 83