about summary refs log tree commit diff
path: root/others/volume1/031.pas
blob: d87ad88cbe3fbd31e423cbb6930520aff743a2c6 (plain) (blame)
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
var
  n, m, i, j, k, l: int16;
  a: array of int16;

begin
  readln(n, m);
  setlength(a, m);
  for i := 0 to m - 1 do
    a[i] := 0;
  for i := 1 to n do
    begin
      read(k);
      for j := 1 to k do
        begin
          read(l);
          inc(a[l - 1])
        end
    end;
  k := 0;
  for i := 0 to m - 1 do
    if a[i] = n then
      inc(k);
  l := 0;
  for i := 0 to m - 1 do
    if a[i] = 0 then
      inc(l);
  writeln(k, ' ', l)
end.