#B4012. Rule Opinion
Rule Opinion
Rule Opinion
There are \(n\) residents and \(m\) days of recordings. Each day, every resident follows exactly one rule. Every rule is identified by a non-negative integer not exceeding \(10^9\). Given a rule code \(k\), the rule is considered popular on a day if at least \(\lceil \frac{n}{2} \rceil\) residents follow it. The rule \(k\) is deemed correct if it is popular on at least \(\lceil \frac{m}{2} \rceil\) days. Output YES
if the rule is correct, otherwise output NO
.
inputFormat
The first line contains three integers: \(n\), \(m\), and \(k\) where:
- \(n\): Number of residents.
- \(m\): Number of days.
- \(k\): The rule code to examine.
The next \(m\) lines each contain \(n\) integers, representing the rule codes followed by the residents on that day.
outputFormat
Output a single line containing YES
if the rule \(k\) is correct according to the criteria; otherwise, output NO
.
sample
3 3 5
5 1 5
5 5 5
1 3 5
YES