結果

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

ソースコード

diff #
raw source code

def solve():
    R = input().strip()
    wrong = input().strip() == "Warong"
    K = int(input())
    former = R[:K]
    latter = R[K:]

    if wrong:
        q_ct = latter.count("?")
        w_ct = latter.count("W")

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

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