結果

問題 No.3685 ワロングアンサーやんけ!
コンテスト
ユーザー Mikankyan
提出日時 2026-09-05 16:20:54
言語 C++23(gcc16)
(gcc 16.1.0 + boost 1.92.0)
コンパイル:
g++-16 -O2 -lm -std=c++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
WA  
実行時間 -
コード長 765 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,333 ms
コンパイル使用メモリ 352,500 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2026-09-05 16:21:03
合計ジャッジ時間 4,910 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9 WA * 23
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
using namespace std;
using ll = long long;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int T;
    cin >> T;
    while(T--) {
        string R, S;
        int K;
        cin >> R >> S >> K;
        if(S == "Warong") {
            for(int k=0; k<K; k++) R[k] = 'A';
            int cnt = 0, cntW = 0;
            for(char c : R) {
                cnt += (c == '?');
                cntW += (c == 'W');
            }
            if(cnt == 1 && cntW == 0) for(char& c : R) if(c == '?') c = 'W';
        } else {
            int cnt = 0;
            for(int k=0; k<K; k++) cnt += (R[k] == '?');
            if(cnt == 1) for(int k=0; k<K; k++) if(R[k] == '?') R[k] = 'W';
        }
        cout << R << endl;
    }
}
0