結果
問題 | No.2925 2-Letter Shiritori |
ユーザー |
👑 |
提出日時 | 2024-06-13 00:26:58 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 805 bytes |
コンパイル時間 | 177 ms |
コンパイル使用メモリ | 82,176 KB |
実行使用メモリ | 84,552 KB |
最終ジャッジ日時 | 2024-10-12 14:00:36 |
合計ジャッジ時間 | 6,558 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | TLE * 1 -- * 1 |
other | -- * 10 |
ソースコード
def interactive_game(): import sys input = sys.stdin.read data = input().split() alpha = data[0] used_strings = set() last_char = alpha for i in range(26): next_char = chr(ord('a') + i) new_string = last_char + next_char if new_string not in used_strings: used_strings.add(new_string) print(f"? {new_string}") sys.stdout.flush() response = input().strip() if response == "! WIN" or response == "! LOSE": break # Update last_char to the second character of the string written by the system if response.startswith("?"): last_char = response[2] else: break if __name__ == "__main__": interactive_game()