#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 nn true/false questions, and mm 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 ii-th question, xx ministers choose correctly and yy ministers choose incorrectly (obviously x+y=mx+y=m). If x>yx>y, then you predict the answer to this question is true; otherwise, you predict it is false. For convenience, we guarantee that mm 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,mn,m, and it is guaranteed that mm is odd.

In the next mm lines, each line contains nn integers. The jj-th integer in the ii-th line represents the ii-th minister's answer to the jj-th question: 11 means they chose correctly, and 00 means they chose incorrectly.

In the next line, there are nn integers representing the official answers of the contest. If the ii-th number bib_i is 11, it means the correct answer to the ii-th question is true; if it is 00, 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, x=1,y=2x=1,y=2. You predict the answer is false (i.e. 00). The actual answer is 1, so the prediction is wrong.
  • For the second question, x=2,y=1x=2,y=1. You predict the answer is true (i.e. 11). The actual answer is 1, so the prediction is correct.
  • For the third question, x=2,y=1x=2,y=1. You predict the answer is true (i.e. 11). The actual answer is 1, so the prediction is correct.

So the number of questions predicted correctly is 22.

[Constraints]

For 20%20\% of the testdata, n5n\le 5, m=1m=1.

For 50%50\% of the testdata, n10n\le 10, m10m\le 10.

For 100%100\% of the testdata, 1n10001 \le n\le 1000, 1m10001 \le m\le 1000, and mm is odd.

Translated by ChatGPT 5