結果

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

ソースコード

diff #
raw source code

#include <bits/stdc++.h>
#define endl '\n'
using namespace std;
using ll = long long;

void solve() {
    string R, S;
    cin >> R >> S;
    ll K;
    cin >> K;

    ll len = R.size();
    if (S == "Warong") {
        for (int i = 0; i < K; i++) R[i] = 'A';
        ll q_cnt = 0;
        ll w_cnt = 0;
        for (int i = 0; i < len; i++) {
            if (R[i] == '?') q_cnt++;
            if (R[i] == 'W') w_cnt++;
        }
        if (w_cnt == 0 && q_cnt == 1) {
            for (int i = 0; i < len; i++) {
                if (R[i] == '?') R[i] = 'W';
            }
        }
    }
    else {
        bool all_a = true;
        for (int i = 0; i < K; i++) {
            if (R[i] != 'A') all_a = false;
        }
        if (all_a) {
            for (int i = 0; i < len; i++) R[i] = 'A';
        }
    }

    cout << R << endl;
    return;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    ll T = 1;
    cin >> T;
    while (T--) {
        solve();
    }
    return 0;
}
0