// 本题为考试单行多行输入输出规范示例,无需提交,不计分。
import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
in.nextLine();
while (in.hasNextInt()) {// 注意,如果输入是多个测试用例,请通过while循环处理多个测试用例
int n = in.nextInt();
int m = in.nextInt();
int s = m;
in.nextLine();
int[] hash = new int[n+1];
while (m>0){
int tempCount = in.nextInt();
in.nextLine();
while (tempCount>0){
int start = in.nextInt();
int end = in.nextInt();
in.nextLine();
for (int i=start; i<=end; i++){
hash[i]++;
}
tempCount--;
}
m--;
}
int resultCount = 0;
ArrayList<Integer> list = new ArrayList<>();
for(int i=0;i<hash.length;i++){
if(hash[i]==s){
resultCount++;
list.add(i);
}
}
System.out.println(resultCount);
for(int i=0;i<list.size()-1;i++){
System.out.print(list.get(i)+" ");
}
System.out.println(list.get(list.size()-1));
}
}
}
难道是没用long吗,不应该啊,题目中给范围了啊,都是在int范围内的啊
全部评论
(3) 回帖