/* -*- coding: utf-8 -*- * * 3280.cc: No.3280 Black-Tailed Gull vs Monster - yukicoder */ #include #include using namespace std; /* constant */ const int MAX_M = 200000; /* typedef */ /* global variables */ int fs[MAX_M]; /* subroutines */ /* main */ int main() { int n, x, qn; scanf("%d%d%d", &n, &x, &qn); int sum = 0; while (qn--) { int m; scanf("%d", &m); for (int i = 0; i < m; i++) scanf("%d", fs + i); sort(fs, fs + m); bool ua = false, fa = false; for (int i = 0; i < m;) { int j = i; while (i < m && fs[j] == fs[i]) i++; if (fs[j] == x) { ua = true; break; } if (i - j > 1) fa = true; } if (ua) sum += 2; else if (fa) sum++; } printf("%.1lf\n", 0.5 * sum); return 0; }