AtCoder Beginner Contest 258
翻译中…
Problem Statement
翻译中…
You are given a simple undirected graph $G$ with $N$ vertices.
翻译中…
$G$ is given as the $N \times N$ adjacency matrix $A$. That is, there is an edge between Vertices $i$ and $j$ if $A_{i,j}$ is $1$, and there is not if $A_{i,j}$ is $0$.
翻译中…
Find the number of triples of integers $(i,j,k)$ satisfying $1 \le i < j < k \le N$ such that there is an edge between Vertices $i$ and $j$, an edge between Vertices $j$ and $k$, and an edge between Vertices $i$ and $k$.
翻译中…
Constraints
翻译中…
$3 \le N \le 3000$$A$is the adjacency matrix of a simple undirected graph$G$.- All values in input are integers.
翻译中…
Input
翻译中…
Input is given from Standard Input in the following format:
翻译中…
N
A_{1,1}A_{1,2}\dots A_{1,N}
A_{2,1}A_{2,2}\dots A_{2,N}
\vdots
A_{N,1}A_{N,2}\dots A_{N,N}
翻译中…
Output
翻译中…
Print the answer.
翻译中…
样例
Input #1
4
0011
0011
1101
1110
Output #1
2
$(i,j,k)=(1,3,4),(2,3,4)$ satisfy the condition.
$(i,j,k)=(1,2,3)$ does not satisfy the condition, because there is no edge between Vertices $1$ and $2$.
Thus, the answer is $2$.
Input #2
10
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
Output #2
0
题目信息
题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。