| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 1 초 | 2048 MB | 102 | 44 | 43 | 44.330% |
You are the chief judge of the International Collegiate Quiz Contest (ICQC) this year. You want to hold judge meetings twice for preparing the problem set of the contest. You proposed candidate schedules for the meetings, and all the judges answered for each of the time slots whether they would attend the meeting on-site or remotely via a video conference tool.
You have to choose a pair of two distinct time slots, so that every judge attends at least one of the two meetings on-site. When there are multiple such pairs, you’d like to choose one with the largest number of judges attending both meetings on-site. If multiple pairs are still equally desirable with these criteria, one with the earlier first meeting is preferred. If there still remain multiple pairs with the same time slot for the first meeting, the one with the earliest second meeting should be chosen.
The input consists of a single test case of the following format.
$n$ $m$
$a_{1,1}$ $\cdots$ $a_{1,m}$
$\vdots$
$a_{n,1}$ $\cdots$ $a_{n,m}$
Two integers $n$ and $m$ are given in the first line. The first integer $n$ (2ドル ≤ n ≤ 2 \times 10^5$) is the number of candidate time slots. Here, the candidate time slots are numbered 1ドル$ through $n,ドル and smaller numbers mean earlier time slots. The second integer $m$ (2ドル ≤ m ≤ 20$) is the number of judges.
In the following $n$ lines, $a_{i,j}$ is either a character Y indicating that the $j$-th judge attends a meeting at the $i$-th candidate time slot on-site, or a character N indicating remote attendance.
Output a line containing the two time slot numbers of the most preferable choice, separated by a space, with the earlier time slot first. If there are no pairs of time slots satisfying the condition, output No.
4 3 NNY YYN YNY NYY
2 3
3 6 NNNYYY YYNYYN YYYNNN
1 3
6 5 NNNNN YNNNY YYNNN YYNNN NYYNY NNYYY
3 6
3 3 YNN NYN NNY
No
4 4 NYNN YNYY YNYN NNYY
1 2