#include <stdio.h> #include <algorithm> using namespace std; typedef struct student{ int num; int score; }; bool compare( student s1, student s2 ){ return s1.num < s2.num; } int main(){ int N,M; scanf("%d%d", &N, &M); student stu[N+M]; for( int i=0; i<N+M; i++ ){ scanf("%d%d", &stu[i].num,&stu[i].score ); } sort(stu,stu+N+M,compare); for( int i=0; i<N+M; i++ ){ printf("%d %d\n", stu[i].num, stu[i].score ); } return 0; } |
Double click to view unformatted code.