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

24793번 - Shiritori 다국어

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

문제

The original version of Shiritori is played using Japanese hiragana, katakana, or kanji characters. Source WikiMedia

The Japanese game of Shiritori is the perfect game for a long car ride. The rules are simple: the first player picks any word to say, then the second player must choose a new word that begins with the last letter of the word that the first player just said. Your job is to determine if the game was played according to these rules, given a history of the words used in a particular game. In a game, player 1ドル$ always starts first.

입력

Input consists of one test case that begins with an integer $N$ (2ドル \leq N \leq 100,000円$) on a single line. Each of the following $N$ lines contains 1ドル$ word. The words are presented in the order in which the players called them out, starting with player 1ドル$. All words consist of between 1ドル$ and 120ドル$ lowercase English letters.

출력

If the game was played according to the rules, output "Fair Game". Otherwise, find out which player first violated the rules of the game. That player lost the game, so output "Player <i> lost". For example, if player 1ドル$ violated the rules first, output "Player 1 lost".

제한

예제 입력 1

5
apple
ear
real
letters
style

예제 출력 1

Fair Game

예제 입력 2

3
apple
extra
apple

예제 출력 2

Player 1 lost

예제 입력 3

2
apple
neat

예제 출력 3

Player 2 lost

예제 입력 4

5
apple
east
team
meat
team

예제 출력 4

Player 1 lost

힌트

출처

School > Virginia Tech High School Programming Contest > 2017 Virginia Tech High School Programming Contest A번

  • 문제를 만든 사람: Henry Wang
(追記) (追記ここまで)

출처

대학교 대회

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

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