-
Notifications
You must be signed in to change notification settings - Fork 6
/
dongwoo.java
36 lines (35 loc) · 1.33 KB
/
dongwoo.java
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
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.StringTokenizer;
public class dongwoo {
public static void main(String[] args) throws IOException {
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
StringBuilder sb = new StringBuilder();
int T = Integer.parseInt(br.readLine());
for (int tc = 0; tc < T; tc++) {
short[][] map = new short[10001][10001];
int N = Integer.parseInt(br.readLine());
int max = 0;
for (int i = 0; i < N; i++) {
StringTokenizer st = new StringTokenizer(br.readLine());
int x = Integer.parseInt(st.nextToken());
int y = Integer.parseInt(st.nextToken());
for(int r = y-5; r<= y+5; r++) {
for (int c = x-5; c <= x+5; c++) {
int val;
try {
val = map[r][c];
} catch (Exception e) {
continue;
}
map[r][c] ++;
max = Math.max(max, map[r][c]);
}
}
}
sb.append(max).append("\n");
}
System.out.println(sb);
}
}