Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
767 B
0
Indexable
Never
#include <iostream>
#include <fstream>
#include <stdint.h>
#include <algorithm>
#include <string>
#include "Header.h" 
using namespace std;
int main() {
	int a, b;
	cin >> a >> b;
	vector <int> c;
	vector <int> d;
	for (int i = 0; i < a; i++){
		int tmp;
		cin >> tmp;
		c.push_back(tmp);
	}
	for (int i = 0; i < b; i++) {
		int tmp;
		cin >> tmp;
		d.push_back(tmp);
	}
	sort(c.begin(), c.end());
	sort(d.begin(), d.end());
	if (c[a / 2] > d[b / 2]) {
		for (int tmp : c){
			cout << tmp << ' ';
		}
		sort(d.rbegin(), d.rend());
		for (int tmp : d) {
			cout << tmp << ' ';
		}
	}
	else {
		for (int tmp : d) {
			cout << tmp << ' ';
		}
		sort(c.rbegin(), c.rend());
		for (int tmp : c) {
			cout << tmp << ' ';
		}
	}

}