题目描述
Problem Background
After consideration by the administrators, we plan to store the unofficial data separately in the last Subtask. These test points are worth 0 points, but failing any of them will be considered as not passing this problem.
Unofficial data provided by: @一扶苏一.
Problem Description
King Kri, the wise ruler, governs a kingdom.
Today, Kri decides to hold a competition to test the wisdom of his ministers.
The competition consists of $n$ true/false questions, with $m$ ministers participating. You now know the answers of all the ministers but have not yet received the official answers, so you decide to make a preliminary prediction.
Specifically, for the $i$-th question, $x$ ministers choose correctly and $y$ ministers choose incorrectly (obviously $x + y = m$). If $x > y$, you predict the answer to be true; otherwise, you predict it to be false. For convenience, we guarantee that $m$ is an odd number.
After the statistics are completed, you receive the official answers. You want to know how many questions you predicted correctly.
Input Format
The first line contains two positive integers $n, m$, with $m$ being an odd number.
The next $m$ lines, each containing $n$ integers, represent the answers of the $i$-th minister to the $j$-th question, where $1$ means he chose correctly and $0$ means he chose incorrectly.
The next line contains $n$ integers, representing the official answers to the competition. The $i$-th number $b_i$ is $1$ if the $i$-th question's answer is true, and $0$ if the answer is false.
Output Format
Output a single integer, representing the number of questions you predicted correctly.
Sample Input and Output
Sample Input #1
3 3
1 0 1
0 1 1
0 1 0
1 1 1
Sample Output #1
2
Sample Input #2
6 5
1 0 1 1 1 0
0 1 0 1 1 1
0 0 1 0 1 0
1 0 1 0 1 0
0 1 0 1 0 0
1 0 1 0 1 0
Sample Output #2
4
Sample Input #3
See attached file kingdom3.in
Sample Output #3
See attached file kingdom3.out
Notes
[Sample 1 Explanation]
- For the first question, $x = 1, y = 2$, you predict the answer to be false (i.e., $0$), but the actual answer is $1$, so the prediction is incorrect.
- For the second question, $x = 2, y = 1$, you predict the answer to be true (i.e., $1$), and the actual answer is $1$, so the prediction is correct.
- For the third question, $x = 2, y = 1$, you predict the answer to be true (i.e., $1$), and the actual answer is $1$, so the prediction is correct.
Thus, the number of correctly predicted questions is $2$.
[Data Range]
For $20\%$ of the data, $n \le 5$, $m = 1$.
For $50\%$ of the data, $n \le 10$, $m \le 10$.
For $100\%$ of the data, $1 \le n \le 1000$, $1 \le m \le 1000$, $m$ is an odd number.
输入格式
见题面 Input 部分
输出格式
见题面 Output 部分