結果
| 問題 | No.3685 ワロングアンサーやんけ! |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-09-06 01:57:50 |
| 言語 | C++23(gcc16) (gcc 16.1.0 + boost 1.92.0 + ACL) |
| 結果 |
WA
不安定
|
| 実行時間 | - |
| コード長 | 2,046 bytes |
| 記録 | |
| コンパイル時間 | 2,064 ms |
| コンパイル使用メモリ | 230,112 KB |
| 実行使用メモリ | 8,448 KB |
| 最終ジャッジ日時 | 2026-09-06 01:58:46 |
| 合計ジャッジ時間 | 4,972 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge3_1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 7 WA * 25 |
ソースコード
#include <stdio.h>
#include <iostream>//cin/cout
#include <string>//cout string
#include <functional>//rambda
#include <algorithm>
#include <iterator>//next/prev
#include <cmath>
#include <numeric>//iota
#include <vector>
#include <array>
#include <set>
#include <map>
#include <queue>
#include <stack>
#include <atcoder/modint.hpp>
using namespace atcoder;
using namespace std;
using llong = long long;
const llong INF = 1LL << 60;//INF > 10^18(1e18)
const int INF32 = 1LL << 30;//INF32 > 10^9(1e9)
template <typename T> bool chmax(T& max, const T& b) {
if (max >= b) return false;
max = b; return true;
}
template <typename T> bool chmin(T& min, const T& b) {
if (min <= b) return false;
min = b; return true;
}
///////////////////ここまでtoolbox/////////////////////////////////////
string solve() {
string R,S;
cin >> R;
int N = R.size();
cin >> S;
int K;
cin >> K;
if (S == "NotWarong") {
//最初のK文字のどこかにWがある
//あるいは、全てAである
int acount = 0;
int qcount = 0;
for (int k = 0; k < K; k++) {
if (R[k] == 'A') {
acount++;
}
if (R[k] == '?') {
qcount++;
}
}
bool wrong = false;
bool ac = true;
for (int n = K; n < N; n++) {
if (R[n] == 'W') {
wrong = true;
}
if (R[n] != 'A') {
ac = false;
}
}
//①最初のK文字が全てAのとき
//全てAが答え
if (acount == K) {
for (int n = 0; n < N; n++) {
R[n] = 'A';
return R;
}
}
//②最初のK文字がAと?1個だけで、かつK+1文字以降が全てAのとき
//K文字のどこかはWだ
//1箇所を除いてAのとき
if (acount == K - 1 and qcount == 1 and ac) {
for (int k = 0; k < K; k++) {
if (R[k] == '?') {
R[k] = 'W';
}
}
return R;
}
//決まらん
return R;
}
for (int k = 0; k < K; k++) {
R[k] = 'A';
}
return R;
}
int main() {
int T;
cin >> T;
vector<string>ans(T);
for (int t = 0; t < T; t++) {
ans[t] = solve();
}
for (int t = 0; t < T; t++) {
cout << ans[t] << endl;
}
return 0;
}