結果

問題 No.3685 ワロングアンサーやんけ!
コンテスト
ユーザー Rumain831
提出日時 2026-09-05 13:44:22
言語 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  
実行時間 -
コード長 590 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 1,180 ms
コンパイル使用メモリ 178,400 KB
実行使用メモリ 9,792 KB
最終ジャッジ日時 2026-09-05 13:48:24
合計ジャッジ時間 3,762 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge1_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 8 WA * 24
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
using ll = long long;

void solve(){
  string r, s; int k; cin >> r >> s >> k;
  int n=r.size();
  if(s[0]=='N'){
    cout << r << '\n'; return;
  }
  int nw=0, nq=0;
  for(int i=k; i<n; i++){
    if(r[i]=='?') nq++;
    if(r[i]=='W') nw++;
  }
  for(int i=0; i<n; i++){
    if(r[i]!='?'){
      cout << r[i]; continue;
    }
    if(i<k){
      cout << 'A'; continue;
    }
    cout << (nw==0&&nq==1?'A':'?');
  }
  cout << '\n';
}

int main(void){
  int t; cin >> t;
  while(t--){
    solve();
  }
  return 0; 
}
0