-
Notifications
You must be signed in to change notification settings - Fork 2
/
Main.java
37 lines (34 loc) · 988 Bytes
/
Main.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
37
package L1_034;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.Arrays;
/**
* @author zmj
* @create 2019/5/5
*/
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[] a = new int[1005];
Arrays.fill(a, 0);
for (int i = 0; i < n; i++) {
String[] line = br.readLine().split(" ");
int k = Integer.parseInt(line[0]);
for (int j = 1; j <= k; j++) {
int f = Integer.parseInt(line[j]);
a[f]++;
}
}
int max = 0;
int res = 0;
for (int i = 1000; i >= 0; i--) {
if (a[i] > max) {
max = a[i];
res = i;
}
}
System.out.println(res + " " + max);
}
}