P8254 [NOI Online 2022 Junior] Kingdom Contest
Background
**After consideration by the administrators, we plan to store the non-official testdata separately in the last Subtask. The score of these test points is 0, but failing any of them will be regarded as not passing this problem.**
Non-official testdata provider: @一扶苏一。
Description
The wise king Kri rules a kingdom.
One day, Kri decided to hold a contest to test the wisdom of his ministers.
The contest consists of $n$ true/false questions, and $m$ ministers participate. You already know all ministers' answers, but you have not obtained the official answers yet, so you decide to make a prediction in advance.
Specifically, for the $i$-th question, $x$ ministers choose correctly and $y$ ministers choose incorrectly (obviously $x+y=m$). If $x>y$, then you predict the answer to this question is true; otherwise, you predict it is false. For convenience, we guarantee that $m$ is odd.
After finishing the statistics, you obtain the official answers. You want to know how many questions your prediction method gets correct in the end.
Input Format
The first line contains two positive integers $n,m$, and it is guaranteed that $m$ is odd.
In the next $m$ lines, each line contains $n$ integers. The $j$-th integer in the $i$-th line represents the $i$-th minister's answer to the $j$-th question: $1$ means they chose correctly, and $0$ means they chose incorrectly.
In the next line, there are $n$ integers representing the official answers of the contest. If the $i$-th number $b_i$ is $1$, it means the correct answer to the $i$-th question is true; if it is $0$, it means the correct answer is false.
Output Format
Output one integer, representing how many questions you predicted correctly in the end.
Explanation/Hint
**[Sample 1 Explanation]**
- For the first question, $x=1,y=2$. You predict the answer is false (i.e. $0$). The actual answer is 1, so the prediction is wrong.
- For the second question, $x=2,y=1$. You predict the answer is true (i.e. $1$). The actual answer is 1, so the prediction is correct.
- For the third question, $x=2,y=1$. You predict the answer is true (i.e. $1$). The actual answer is 1, so the prediction is correct.
So the number of questions predicted correctly is $2$.
**[Constraints]**
For $20\%$ of the testdata, $n\le 5$, $m=1$.
For $50\%$ of the testdata, $n\le 10$, $m\le 10$.
For $100\%$ of the testdata, $1 \le n\le 1000$, $1 \le m\le 1000$, and $m$ is odd.
Translated by ChatGPT 5