-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathunionarray.cpp
More file actions
42 lines (40 loc) · 975 Bytes
/
unionarray.cpp
File metadata and controls
42 lines (40 loc) · 975 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
37
38
39
40
41
42
#include <bits/stdc++.h>
using namespace std;
#define m1 1000000007
#define int long long
#define float double
#define vi vector<int>
#define pb push_back
#define mp make_pair
#define ff first
#define ss second
#define all(c) c.begin(), c.end()
#define mid(l, r) (l + (r - l) / 2)
#define loop(i, a, b) for(int i = (a); i<= (b); i++)
#define loopneg(i, a, b) for(int i = (a); i>= (b); i--)
#define arll(n) long long ar[n]
#define fast ios_base::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
int32_t main(){
fast
int n1,n2;
cin>>n1>>n2;
int a[n1],b[n2];
vector<int> c;
for(int i=0; i<n1; i++){
cin>>a[i];
c.push_back(a[i]);
}
for(int i=0; i<n2; i++){
cin>>b[i];
c.push_back(b[i]);
}
sort(all(c));
vector<int>d;
d.push_back(c[0]);
for(int i=1; i<c.size(); i++){
if(c[i]!=c[i-1]){
d.push_back(c[i]);
}
}
cout<<d.size()<<endl;
}