View Code of Problem 83

#include<bits/stdc++.h>
using namespace std;
struct P{
	int id,s;
}p[100];
bool cmp(P,P); 
int main(){
	int n,m;
	cin>>n>>m;
	for(int i = 0;i<n;i++)cin>>p[i].id>>p[i].s;
	for(int i = n;i<m+n;i++)cin>>p[i].id>>p[i].s;
	sort(p,n+p+m,cmp);
	for(int i = 0;i<m+n;i++)cout<<p[i].id<<" "<<p[i].s<<endl;
	return 0;
}
bool cmp(P a,P b){
	return a.id < b.id;
}

Double click to view unformatted code.


Back to problem 83