Logo
(追記) (追記ここまで)

19136번 - Balls and Holes 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
0.5 초 512 MB80371947.500%

문제

Bobo invents a game and keeps playing.

A game $(\{a_1, a_2, \dots, a_m\}, \{b_1, b_2, \dots, b_l\})$ is played on the axis. First, bobo places $m$ balls at $a_1, a_2, \dots, a_m,ドル respectively. Then bobo digs $l$ holes at $b_1 + 0.5, b_2 + 0.5, \dots, b_l + 0.5$. Finally bobo pushes all balls forward so that the balls fall into the holes. bobo wins if and only if there are odd number of holes containing at least one ball.

Now bobo has $n$ sets $S_1, S_2, \dots, S_n,ドル and he wants to know how many games as $(S_i, S_j)$ $(i < j)$ he can win.

입력

The first line contains an integer $n$ (2ドル \leq n \leq 5000$).

Each of the following $n$ lines contains an integer $k_i,ドル which denotes the size of $S_i,ドル followed by $k_i$ distinct integers $S_{i, 1}, S_{i, 2}, \dots, S_{i, k_i}$ which denotes the set $S_i$ (1ドル \leq k_i \leq 50, 1 \leq S_{i, j} \leq 50$).

출력

A single integer denotes the number games bobo can win.

제한

예제 입력 1

2
1 1
2 1 2

예제 출력 1

1

예제 입력 2

2
2 1 2
2 2 1

예제 출력 2

0

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2015 > Day 3: Chinese Contest C번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /