結果

問題 No.3685 ワロングアンサーやんけ!
コンテスト
ユーザー kmmtkm
提出日時 2026-09-05 14:47:22
言語 PyPy3
(7.3.23)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 334 ms / 2,000 ms
+ 764µs
コード長 661 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 240 ms
コンパイル使用メモリ 96,080 KB
実行使用メモリ 98,636 KB
最終ジャッジ日時 2026-09-05 14:47:34
合計ジャッジ時間 6,485 ms
ジャッジサーバーID
(参考情報)
judge6_1 / judge7_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 32
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

def solve(_r, s, k):
    if s == "Warong":
        r = list(_r)
        for i in range(k):
            r[i] = "A"
        if r.count("?") == 1 and r.count("W") == 0:
            r[r.index("?")] = "W"
    else:
        r = list(_r)
        if _r[:k] == "A" * k:
            r = ["A"] * len(r)
        elif "W" in r and "W" not in r[:k] and r[:k].count("?") == 1:
            r[r[:k].index("?")] = "W"

    return "".join(r)


def main():
    ans = []
    t = int(input())
    for _ in range(t):
        r = input()
        s = input()
        k = int(input())
        ans.append(solve(r, s, k))

    print("\n".join(ans))


if __name__ == "__main__":
    main()
0