結果

問題 No.2925 2-Letter Shiritori
ユーザー loop0919loop0919
提出日時 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
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 -- -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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()
0