結果

問題 No.3685 ワロングアンサーやんけ!
コンテスト
ユーザー hotaru-ishibashi
提出日時 2026-09-08 13:17:45
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 698 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 64 ms
コンパイル使用メモリ 81,712 KB
実行使用メモリ 84,864 KB
最終ジャッジ日時 2026-09-08 13:17:55
合計ジャッジ時間 5,570 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 19 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def solve():
    R = input().strip()
    wrong = input().strip() == "Warong"
    K = int(input())

    if wrong:
        # AAAA...AAA
        latter = R[K:]
        q_ct = latter.count("?")
        w_ct = latter.count("W")
        if q_ct == 1 and w_ct == 0: latter.replace("?", "W")
        print(R[:K].replace("?", "A") + latter)
    else:
        former = R[:K]
        latter = R[K:]

        if latter.count("W") > 0 and former.count("?") == 1 and former.count("W") == 0:
            print(former.replace("?", "W") + latter)
        elif former.count("A") != K:
            print(R)
        else:
            # 全てA
            print("A" * len(R))

for _ in range(int(input())):
    solve()
0