-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBOJ_10527.java
More file actions
44 lines (38 loc) · 1.43 KB
/
Copy pathBOJ_10527.java
File metadata and controls
44 lines (38 loc) · 1.43 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
// BOJ - 10527
// Problem Sheet - https://www.acmicpc.net/problem/10527
import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader bf = new BufferedReader(new InputStreamReader(System.in));
Map<String, Integer> domJudgeOutputs = new HashMap<>();
Map<String, Integer> kattisOutputs = new HashMap<>();
int answer = 0;
int submissionCount = Integer.parseInt(bf.readLine());
String result;
for(int i=0 ; i<submissionCount ; i++) {
result = bf.readLine();
if(!domJudgeOutputs.containsKey(result)) {
domJudgeOutputs.put(result, 1);
} else {
domJudgeOutputs.put(result, domJudgeOutputs.get(result) + 1);
}
}
for(int i=0 ; i<submissionCount ; i++) {
result = bf.readLine();
if(!kattisOutputs.containsKey(result)) {
kattisOutputs.put(result, 1);
} else {
kattisOutputs.put(result, kattisOutputs.get(result) + 1);
}
}
for(Map.Entry<String, Integer> entry : domJudgeOutputs.entrySet()) {
if(kattisOutputs.containsKey(entry.getKey())) {
answer += Math.min(entry.getValue(), kattisOutputs.get(entry.getKey()));
}
}
System.out.println(answer);
bf.close();
System.exit(0);
}
}