-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path23305.cpp
More file actions
49 lines (42 loc) · 704 Bytes
/
23305.cpp
File metadata and controls
49 lines (42 loc) · 704 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
43
44
45
46
47
48
49
// 23305. 수강변경
// 2022.02.19
// 그리디 알고리즘
#include<iostream>
using namespace std;
int arr[1000001];
int main()
{
int n;
cin >> n;
int minVal = 1000001;
int maxVal = -1;
int k;
for (int i = 0; i < n; i++)
{
cin >> k;
if (k < minVal)
{
minVal = k;
}
if (k > maxVal)
{
maxVal = k;
}
arr[k]++;
}
for (int i = 0; i < n; i++)
{
cin >> k;
if (arr[k] > 0)
{
arr[k]--;
}
}
int ans = 0;
for (int i = minVal; i <= maxVal; i++)
{
ans += arr[i];
}
cout << ans << endl;
return 0;
}