更新
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
import java.util.Scanner;
|
||||
|
||||
public class P2857 {
|
||||
public static void main(String[] args) {
|
||||
Scanner in = new Scanner(System.in);
|
||||
int n = in.nextInt();
|
||||
int[] mention = new int[101];
|
||||
boolean[][] by = new boolean[101][101];
|
||||
for (int i = 0; i < n; i++) {
|
||||
int sender = in.nextInt();
|
||||
int k = in.nextInt();
|
||||
for (int j = 0; j < k; j++) {
|
||||
int id = in.nextInt();
|
||||
if (id >= 0 && id <= 100) {
|
||||
mention[id]++;
|
||||
if (sender >= 0 && sender <= 100) by[id][sender] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
int bestId = 0;
|
||||
int bestCount = -1;
|
||||
for (int id = 0; id <= 100; id++) {
|
||||
if (mention[id] > bestCount) {
|
||||
bestCount = mention[id];
|
||||
bestId = id;
|
||||
}
|
||||
}
|
||||
System.out.println(bestId);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
boolean first = true;
|
||||
for (int s = 0; s <= 100; s++) {
|
||||
if (by[bestId][s]) {
|
||||
if (!first) sb.append(' ');
|
||||
sb.append(s);
|
||||
first = false;
|
||||
}
|
||||
}
|
||||
System.out.println(sb.toString());
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 2.4 MiB |
Reference in New Issue
Block a user