Logo
(追記) (追記ここまで)

33009번 - Scheduling Two Meetings 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 2048 MB102444344.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.

제한

예제 입력 1

4 3
NNY
YYN
YNY
NYY

예제 출력 1

2 3

예제 입력 2

3 6
NNNYYY
YYNYYN
YYYNNN

예제 출력 2

1 3

예제 입력 3

6 5
NNNNN
YNNNY
YYNNN
YYNNN
NYYNY
NNYYY

예제 출력 3

3 6

예제 입력 4

3 3
YNN
NYN
NNY

예제 출력 4

No

예제 입력 5

4 4
NYNN
YNYY
YNYN
NNYY

예제 출력 5

1 2

힌트

출처

ICPC > Regionals > Asia Pacific > Japan > 2024 ICPC Asia Yokohama Regional Contest K번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /