結果
| 問題 | No.3685 ワロングアンサーやんけ! |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-07-21 22:38:11 |
| 言語 | C++23 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 174 ms / 2,000 ms |
| + 179µs | |
| コード長 | 1,481 bytes |
| 記録 | |
| コンパイル時間 | 2,028 ms |
| コンパイル使用メモリ | 338,396 KB |
| 実行使用メモリ | 9,768 KB |
| 最終ジャッジ日時 | 2026-09-05 12:44:52 |
| 合計ジャッジ時間 | 5,105 ms |
|
ジャッジサーバーID (参考情報) |
judge1_0 / judge4_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 32 |
ソースコード
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll inf = (1LL<<60);
int main() {
int T;
cin >> T;
while(T){
T--;
string str,ptn;
int x;
cin >> str >> ptn >> x;
int len = str.length();
if(ptn == "Warong"){
bool check = true;
queue<int> que;
for(int i=0;i<len;i++){
if(i < x) str[i] = 'A';
else{
if(str[i] == '?') que.push(i);
if(str[i] == 'W') check = false;
}
}
if(que.size() == 1 && check){
str[que.front()] = 'W';
}
cout << str << endl;
}
if(ptn == "NotWarong"){
bool frontAllA = true,backwExist = false, frontwExist = false;
queue<int>que;
for(int i=0;i<x;i++){
if(str[i] != 'A'){
frontAllA = false;
if(str[i] == 'W') frontwExist = true;
if(str[i] == '?') que.push(i);
}
}
for(int i=x;i<len;i++){
if(str[i] == 'W') backwExist = true;
}
if(frontAllA){
string ans(len,'A');
str = ans;
}else if(!frontwExist && backwExist && que.size() == 1){
str[que.front()] = 'W';
}
cout << str << endl;
}
}
}