#abc258g. G - Triangle
G - Triangle
Score : points
问题描述
给定一个包含 个顶点的简单无向图 。
通过一个 的邻接矩阵 给出。即,若 为 ,则表示顶点 和顶点 之间存在一条边;若 为 ,则表示它们之间不存在边。
找出满足条件 的整数三元组 的数量,使得在顶点 和顶点 之间、顶点 和顶点 之间以及顶点 和顶点 之间都存在边。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
You are given a simple undirected graph with vertices.
is given as the adjacency matrix . That is, there is an edge between Vertices and if is , and there is not if is .
Find the number of triples of integers satisfying such that there is an edge between Vertices and , an edge between Vertices and , and an edge between Vertices and .
Constraints
- is the adjacency matrix of a simple undirected graph .
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
4
0011
0011
1101
1110
Sample Output 1
2
satisfy the condition.
does not satisfy the condition, because there is no edge between Vertices and .
Thus, the answer is .
Sample Input 2
10
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
0000000000
Sample Output 2
0
update @ 2024/3/10 10:58:28