結果

問題 No.2925 2-Letter Shiritori
ユーザー 👑 loop0919loop0919
提出日時 2024-06-11 23:12:57
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 733 bytes
コンパイル時間 151 ms
コンパイル使用メモリ 81,976 KB
実行使用メモリ 73,380 KB
平均クエリ数 25.67
最終ジャッジ日時 2024-10-12 14:00:21
合計ジャッジ時間 2,386 ms
ジャッジサーバーID
(参考情報)
judge / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample WA * 2
other WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

import random

random.seed(1)

alphabets = "abcdefghijklmnopqrstuvwxyz"

written = set()

alpha = input()
print('?', alpha * 2)

written.add(alpha * 2)

for _ in range(5):
    cmd, T = input().split()
    
    written.add(T)
    
    print('?', T[::-1])
    
    written.add(T[::-1])

cmd, T = input().split()
written.add(T)

S = list({T[1] + a for a in alphabets} - written)[0]

print('?', S)

while True:
    cmd, T = input().split()
    
    if cmd == '!':
        exit()
    
    written.add(T)
    
    can_write = list(set(T[1] + a for a in alphabets) - written)

    if len(can_write) <= 0:
        print('!')
    else:
        S = random.choice(can_write)
        pre_char = S[1]
        written.add(S)
        print('?', S)
0