-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path11728.cpp
More file actions
66 lines (49 loc) · 1.05 KB
/
11728.cpp
File metadata and controls
66 lines (49 loc) · 1.05 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
55
56
57
58
59
60
61
62
63
64
65
66
//
// 11728.cpp
// algo
//
// Created by 박효정 on 2021/08/08.
//
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
int main(){
cin.tie(0);
cout.tie(0);
std::ios::sync_with_stdio(false);
int a;
int b;
cin>>a>>b;
vector<int>a_list(a);
vector<int>b_list(b);
vector<int>res;
for(int i=0;i<a;i++){
cin>>a_list[i];
}
for(int i=0;i<b;i++){
cin>>b_list[i];
}
sort(a_list.begin(),a_list.end());
sort(b_list.begin(), b_list.end());
int a_point=0;
int b_point=0;
while(a_point<a&&b_point<b){
if(a_list[a_point]<b_list[b_point]){
res.push_back(a_list[a_point++]);
}else{
res.push_back(b_list[b_point++]);
}
}
while(a_point<a){
res.push_back(a_list[a_point++]);
}
while(b_point<b){
res.push_back(b_list[b_point++]);
}
for(int i=0;i<res.size();i++){
cout<<res[i]<<' ';
}
cout<<"\n";
return 0;
}