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

20732번 - Proofs 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 512 MB78563784.091%

문제

You are teaching discrete math. You have done your best to teach your students about axioms and inference rules, proofs and theorems. Sometimes the students write beautiful proofs that Fermat would be proud of but sometimes, also like Fermat, their proofs are not quite right. You are getting a little tired of hunting through some of these so-called "proofs" for the magic tricks that let them prove 1ドル = 2$ and had the great idea to write a computer program to speed things up!

Because this is the first class in proof-based mathematics, you have started your students off with a simple proof system. All proof lines consist of a list of assumptions, an arrow, and a conclusion. If there are no assumptions, the conclusion is an axiom. A line of the proof is valid if and only if all assumptions were conclusions of previous lines. Sometimes the students derive a conclusion more than once just to be extra sure it is true, and that is perfectly all right!

입력

The first line of input consists of an integer 1ドル \le n \le 400,000円,ドル the number of lines in the "proof". Then follow the $n$ lines of the "proof". Each line has 0ドル \le a \le 5$ assumptions, followed by an arrow (the string "->"), followed by one conclusion. All assumptions and conclusions consist of 1ドル \le c \le 5$ uppercase alphabetic characters. The assumptions, arrow, and conclusion are all separated by single spaces.

출력

If every line is correct output "correct". Otherwise, output the number of the first line with an error (line numbers start at 1ドル$).

제한

예제 입력 1

3
-> ALICE
-> BOB
ALICE BOB -> CARL

예제 출력 1

correct

예제 입력 2

1
A -> B

예제 출력 2

1

힌트

출처

Contest > KTH Challenge > KTH Challenge 2020 F번

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

출처

대학교 대회

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

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