結果
| 問題 | No.3685 ワロングアンサーやんけ! |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-05 15:20:35 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,247 bytes |
| 記録 | |
| コンパイル時間 | 3,915 ms |
| コンパイル使用メモリ | 376,036 KB |
| 実行使用メモリ | 9,796 KB |
| 最終ジャッジ日時 | 2026-09-05 15:20:48 |
| 合計ジャッジ時間 | 6,821 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge5_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 17 WA * 15 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using ll = long long;
#define rep(i, s, t) for (ll i = s; i < (ll)(t); i++)
#define all(x) begin(x), end(x)
template <class T> bool chmin(T& x, T y) {
return x > y ? (x = y, true) : false;
}
template <class T> bool chmax(T& x, T y) {
return x < y ? (x = y, true) : false;
}
void solve() {
string s, t;
int k;
cin >> s >> t >> k;
int n = s.size();
if (t == "Warong") {
rep(i, 0, k) s[i] = 'A';
int w = 0, ww = 0;
rep(i, k, n) {
if (s[i] == 'W') w++;
if (s[i] == '?') ww++;
}
if (w == 0 && ww == 1) {
rep(i, k, n) if (s[i] == '?') s[i] = 'W';
}
cout << s << '\n';
return;
}
int q1 = 0, q2 = 0;
rep(i, 0, k) if (s[i] == '?') q1++;
rep(i, k, n) if (s[i] == '?') q2++;
if (q1 == 0 && q2 > 0) {
int na = 0;
rep(i, 0, k) if (s[i] != 'A') na++;
if (na == 0) {
rep(i, k, n) if (s[i] == '?') s[i] = 'A';
}
} else if (q1 > 0 && q2 == 0) {
int cw = 0;
rep(i, k, n) if (s[i] == 'W') cw++;
if (cw > 0 && q1 == 1) {
rep(i, 0, k) if (s[i] == '?') s[i] = 'W';
}
}
cout << s << '\n';
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout << fixed << setprecision(15);
int t = 1;
cin >> t;
while (t--) solve();
}