-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBOJ_17048.java
More file actions
32 lines (26 loc) · 1.08 KB
/
Copy pathBOJ_17048.java
File metadata and controls
32 lines (26 loc) · 1.08 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
// BOJ - 17048
// Problem Sheet - https://www.acmicpc.net/problem/17048
import java.util.*;
import java.io.*;
public class Main {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
int n = Integer.parseInt(br.readLine());
int[] initFreq = Arrays.stream(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
int[] requiredFreq = Arrays.stream(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray();
Map<Integer, Integer> freqDiffsCount = new HashMap<>();
for (int i=0 ; i<n ; i++) {
int diff = initFreq[i] - requiredFreq[i];
freqDiffsCount.put(diff, freqDiffsCount.getOrDefault(diff, 0) + 1);
}
int maxControlableDronCount = 0;
for (int count : freqDiffsCount.values()) {
if (count > maxControlableDronCount) {
maxControlableDronCount = count;
}
}
System.out.println(maxControlableDronCount);
br.close();
System.exit(0);
}
}