forked from encrypted-def/basic-algo-lecture
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path1822.cpp
More file actions
36 lines (30 loc) · 706 Bytes
/
1822.cpp
File metadata and controls
36 lines (30 loc) · 706 Bytes
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
// Authored by : unluckyjung
// Co-authored by : -
// http://boj.kr/5cd27ecd3608402da947337b18e2baad
#include <bits/stdc++.h>
using namespace std;
vector<int> A, B;
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, m;
cin >> n >> m;
int num;
for (int i = 0; i < n; ++i) {
cin >> num;
A.push_back(num);
}
for (int i = 0; i < m; ++i) {
cin >> num;
B.push_back(num);
}
sort(A.begin(), A.end());
sort(B.begin(), B.end());
vector<int> ans;
for (int num : A) {
if (binary_search(B.begin(), B.end(), num)) continue;
ans.push_back(num);
}
cout << ans.size() << "\n";
for (int num : ans) cout << num << " ";
}