-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathp11728.java
More file actions
54 lines (48 loc) · 1.32 KB
/
p11728.java
File metadata and controls
54 lines (48 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import java.io.*;
import java.util.*;
/*
MERGE - SORT
2 2
3 5
2 9
*/
public class p11728 {
static int n, m, a[], b[], ms[];
static BufferedReader br;
static BufferedWriter bw;
static StringTokenizer st;
static StringBuilder sb;
public static void main(String[] args) throws IOException {
br = new BufferedReader(new InputStreamReader(System.in));
bw = new BufferedWriter(new OutputStreamWriter(System.out));
st = new StringTokenizer(br.readLine());
sb = new StringBuilder();
n = Integer.parseInt(st.nextToken());
m = Integer.parseInt(st.nextToken());
a = new int[n];
b = new int[m];
ms = new int[n + m];
st = new StringTokenizer(br.readLine());
for (int i = 0; i < n; ++i) {
a[i] = Integer.parseInt(st.nextToken());
}
Arrays.sort(a);
st = new StringTokenizer(br.readLine());
for (int i = 0; i < m; ++i) {
b[i] = Integer.parseInt(st.nextToken());
}
Arrays.sort(b);
for (int i = 0; i < n; ++i) {
ms[i] = a[i];
}
for (int i = n; i < n + m; ++i) {
ms[i] = b[i - n];
}
Arrays.sort(ms);
for (int x : ms) {
bw.write(x+" ");
}
bw.flush();
bw.close();
}
}