#T726. 【NOI Online 2022-J1】王国比赛
【NOI Online 2022-J1】王国比赛
Description
The wise king Kri rules over a kingdom.
One day, Kri decided to hold a competition to test the wisdom of his ministers.
The competition consists of n true/false questions, with m ministers participating. You already know the answers given by all the ministers but have not yet received the correct answers, so you decide to make a prediction first.
Specifically, for the i-th question, if x ministers answered correctly and y answered incorrectly (note that x + y = m), you predict the answer to be correct if x > y and incorrect otherwise. For convenience, it is guaranteed that m is an odd number.
After compiling the statistics, you receive the actual answers. Now, you want to know how many questions you predicted correctly using your method.
Input Format
The first line contains two positive integers n and m, where m is guaranteed to be odd.
The next m lines each contain n integers. The j-th integer a_ij in the i-th line represents the answer given by the i-th minister for the j-th question: 1 indicates they answered correctly, and 0 indicates they answered incorrectly.
The following line contains n integers representing the actual answers to the questions. The i-th integer b_i is 1 if the answer to the i-th question is correct and 0 otherwise.
Output Format
Output a single integer representing the number of questions you predicted correctly.
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
Hint
Explanation for Sample 1
For the first question where x=1, y=2, you predicted the answer to be incorrect (i.e., 0), but the actual answer was 1, so your prediction was wrong.
For the second question where x=2, y=1, you predicted the answer to be correct (i.e., 1), and the actual answer was 1, so your prediction was correct.
For the third question where x=2, y=1, you predicted the answer to be correct (i.e., 1), and the actual answer was 1, so your prediction was correct.
Thus, the number of correctly predicted questions is 2.
Data Range
For 20% of the data, n ≤ 5 and m = 1.
For 50% of the data, n ≤ 10 and m ≤ 10.
For 100% of the data, n ≤ 1000, m ≤ 1000, and m is an odd number.
Source
NOI Online 2022-J1