CF844B.Rectangles
普及-
通过率:0%
时间限制:1.00s
内存限制:256MB
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You are given n × m table. Each cell of the table is colored white or black. Find the number of non-empty sets of cells such that:
- All cells in a set have the same color.
- Every two cells in a set share row or column.
给你一个 n×m 的表格,表格中的每个单元格被染成白色或黑色。求满足以下条件的非空单元格集合的个数:
- 集合中所有单元格颜色相同;
- 集合中任意两个单元格位于同一行或同一列。
输入格式
The first line of input contains integers n and m (1 ≤ n, m ≤ 50) — the number of rows and the number of columns correspondingly.
The next n lines of input contain descriptions of rows. There are m integers, separated by spaces, in each line. The number equals 0 if the corresponding cell is colored white and equals 1 if the corresponding cell is colored black.
输入的第一行包含两个整数 n 和 m(1 ≤ n, m ≤ 50),分别表示行数和列数。
接下来的 n 行输入描述了各行。每行包含 m 个用空格分隔的整数:若该数为 0,则对应单元格为白色;若该数为 1,则对应单元格为黑色。
输出格式
Output single integer — the number of non-empty sets from the problem description.
输出一个整数——即题目描述中非空集合的个数。
输入输出样例
输入#1
1 1 0
输出#1
1
输入#2
2 3 1 0 1 0 1 0
输出#2
8
说明/提示
In the second example, there are six one-element sets. Additionally, there are two two-element sets, the first one consists of the first and the third cells of the first row, the second one consists of the first and the third cells of the second row. To sum up, there are 8 sets.
在第二个例子中,存在六个单元素集合。此外,还有两个双元素集合:第一个双元素集合由第一行的第一个和第三个单元格组成,第二个双元素集合由第二行的第一个和第三个单元格组成。综上,共有 8 个集合。
输入解题思路,AI测评打分。不知道怎么写?