#P8254. [NOI Online 2022 入门组] 王国比赛
[NOI Online 2022 入门组] 王国比赛
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: @一扶苏一。
Problem 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 true/false questions, and 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 -th question, ministers choose correctly and ministers choose incorrectly (obviously ). If , then you predict the answer to this question is true; otherwise, you predict it is false. For convenience, we guarantee that 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 , and it is guaranteed that is odd.
In the next lines, each line contains integers. The -th integer in the -th line represents the -th minister's answer to the -th question: means they chose correctly, and means they chose incorrectly.
In the next line, there are integers representing the official answers of the contest. If the -th number is , it means the correct answer to the -th question is true; if it is , it means the correct answer is false.
Output Format
Output one integer, representing how many questions you predicted correctly in the end.
3 3
1 0 1
0 1 1
0 1 0
1 1 1
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
4
见附件中的 kingdom3.in
见附件中的 kingdom3.out
Hint
[Sample 1 Explanation]
- For the first question, . You predict the answer is false (i.e. ). The actual answer is 1, so the prediction is wrong.
- For the second question, . You predict the answer is true (i.e. ). The actual answer is 1, so the prediction is correct.
- For the third question, . You predict the answer is true (i.e. ). The actual answer is 1, so the prediction is correct.
So the number of questions predicted correctly is .
[Constraints]
For of the testdata, , .
For of the testdata, , .
For of the testdata, , , and is odd.
Translated by ChatGPT 5