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

19360번 - Walk of Length 6 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB833100.000%

문제

Bobo has an undirected graph with $n$ vertices which are conveniently labeled with 1,ドル 2, \dots, n$. Let $V$ be the set of vertices and $E$ be the set of edges. He would like to count the number of tuples $(v_1, v_2, \dots, v_6)$ where:

  • $v_1, v_2, \dots, v_6 \in V,ドル
  • $\{v_1, v_2\}, \{v_2, v_3\}, \dots, \{v_5, v_6\}, \{v_6, v_1\} \in E$;
  • $\mathcal{C} = (\{v_1, v_2\}, \{v_2, v_3\}, \dots, \{v_5, v_6\}, \{v_6, v_1\})$ is not a simple cycle of length 6ドル$.

입력

The input contains zero or more test cases, and is terminated by end-of-file. For each test case:

The first line contains an integer $n$ (1ドル \leq n \leq 1000$).

The $i$-th of the following $n$ lines contains a string $g_i$ of length $n$ where $g_{i, j}$ denotes the existence of edge $\{i, j\}$ ($g_{i, j} \in \{0, 1\},ドル $g_{i, i} = 0,ドル $g_{i, j} = g_{j, i}$).

It is guaranteed that the sum of $n$ does not exceed 1000ドル$.

출력

For each test case, output an integer which denotes the number of tuples.

제한

예제 입력 1

3
011
101
110
4
0101
1010
0101
1010
6
011111
101111
110111
111011
111101
111110

예제 출력 1

66
128
14910

힌트

출처

Camp > Petrozavodsk Programming Camp > Winter 2017 > Day 2: Xiaoxu Guo Contest B번

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

출처

대학교 대회

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

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