Pascal Library
InterviewTime limit1sMemory limit128 MB
Given D attendance rows over N alumni, decide whether some alumnus attended every dinner.
- Level
Easy2 of 10
- Topics
- Array, Implementation, Brute force
- Solved
- No attempts yet
Problem
Pascal University, one of the oldest in the country, needs to renovate its Library Building, because after all these centuries the building has started to show the effects of supporting the weight of the enormous amount of books it houses.
To help with the renovation, the University's Alumni Association decided to organize a series of fund-raising dinners, to which all alumni were invited. These events proved to be a huge success and several were held during the past year.
The organizers kept a spreadsheet recording which alumni attended each dinner. Now they want your help to determine whether any alumnus or alumna attended all of the dinners.
Input
The input contains several test cases. The first line of each test case contains two integers and , indicating respectively the number of alumni and the number of dinners organized ( and ). Alumni are identified by integers from to . Each of the next lines describes the attendees of one dinner and contains integers , where means that alumnus/alumna attended that dinner and means they did not.
The end of the input is indicated by .
Output
For each test case, your program must produce one line of output containing either the word yes, if there is at least one alumnus/alumna who attended all of the dinners, or the word no otherwise.
Hint
- Alumna: a former female student of a particular school, college or university.
- Alumnus: a former male student of a particular school, college or university.
- Alumni: former students of either sex of a particular school, college or university.