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

24599번 - Fail Them All! 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 (추가 시간 없음) 1024 MB106353139.744%

문제

You are an instructor for an algorithms course, and your students have been saying mean things about you on social media. Those jerks! Being a vengeful and dishonest instructor, you are going to make them pay.

You have given your students a True/False exam. For each question, each student is allowed to either answer the question or leave the question blank. Each student has answered at least two questions. You want to make sure that every student fails the test, so you are going to alter the answer key so that no student gets more than one answer correct.

Is there an answer key such that every person has at most one submitted answer that is correct? If so, compute the lexicographically minimal such answer key.

입력

The first line of input contains two integers $n$ (1ドル \le n \le 100$) and $k$ (2ドル \le k \le 100$), where $n$ is the number of students in the class, and $k$ is the number of questions on the test.

Each of the next $n$ lines contains a string $s$ ($|s| = k,ドル $s \in \{\texttt{T}, \texttt{F}, \texttt{X}\}^*$), which are the answers to the questions, in order, for each student, where 'T' means True, 'F' means False, and 'X' means the student didn't answer the question. Every student's answers will have at least two which are not 'X'.

출력

If such an answer key can be constructed, output a string of length $k$ consisting of only the characters 'T' and 'F', which is the answer key. If more than one such key is possible, output the one which comes first alphabetically ('F' < 'T'). If no such key exists, instead output -1.

제한

예제 입력 1

3 3
FFX
XFF
FXF

예제 출력 1

FTT

예제 입력 2

3 3
FTX
XFT
TXF

예제 출력 2

FFF

예제 입력 3

4 3
TTX
XTT
TXT
FFF

예제 출력 3

-1

힌트

출처

ICPC > Regionals > North America > Pacific Northwest Regional > 2021 ICPC Pacific Northwest Region > Division 1 J번

ICPC > Regionals > North America > Pacific Northwest Regional > 2021 ICPC Pacific Northwest Region > Division 2 W번

ICPC > Regionals > North America > South Central USA Regional > 2021 South Central USA Regional Contest > Division 1 E번

ICPC > Regionals > North America > Mid-Central Regional > Mid-Central USA Programming Contest 2021 F번

ICPC > Regionals > North America > Northeast North America Regional > 2021 Northeast North America Regional Contest I번

ICPC > Regionals > North America > Southeast USA Regional > 2021 Southeast USA Regional Programming Contest > Division 1 E번

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

출처

대학교 대회

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

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