Scheduling Two Meetings
Time limit1sMemory limit2048 MB
Given n time slots with a Y/N on-site mask over m judges, pick two slots whose on-site sets cover every judge and share the most on-site judges.
- Level
Medium6 of 10
- Topics
- Bit manipulation, Dynamic programming
- Solved
- No attempts yet
문제
You are the chief judge of the International Collegiate Quiz Contest (ICQC) this year. You want to hold judge meetings twice to prepare the problem set for the contest. You proposed several candidate schedules for the meetings, and every judge answered, for each time slot, whether they would attend on-site or remotely through a video conference tool.
Choose two distinct time slots so that every judge attends at least one of the two meetings on-site. If several pairs qualify, choose the pair with the largest number of judges attending both meetings on-site. If pairs still tie, choose the one with the earlier first meeting. If the first meetings also tie, choose the one with the earlier second meeting.
Input
The first line contains two integers and . () is the number of candidate time slots, numbered 1 through , where a smaller number is an earlier slot. () is the number of judges.
Each of the next lines contains characters. is Y if judge attends the meeting at slot on-site, and N if judge attends remotely.
Output
Print the two time slot numbers of the best pair on one line, separated by a space, with the earlier slot first. If no pair satisfies the condition, print No.