結果

問題 No.2240 WAC
ユーザー Yui MaisaYui Maisa
提出日時 2023-03-10 22:37:56
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,389 bytes
コンパイル時間 2,227 ms
コンパイル使用メモリ 202,420 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-18 08:19:26
合計ジャッジ時間 7,881 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 AC 2 ms
4,348 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 AC 2 ms
4,348 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 2 ms
4,348 KB
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 AC 5 ms
4,348 KB
testcase_14 AC 3 ms
4,348 KB
testcase_15 AC 8 ms
4,348 KB
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 AC 9 ms
4,348 KB
testcase_21 RE -
testcase_22 RE -
testcase_23 AC 5 ms
4,348 KB
testcase_24 RE -
testcase_25 RE -
testcase_26 RE -
testcase_27 AC 4 ms
4,348 KB
testcase_28 RE -
testcase_29 AC 3 ms
4,348 KB
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 AC 9 ms
4,348 KB
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

/*main*/
int main() {
  int n,m; cin >> n >> m;
  string s; cin >> s;
  int flag = 0;
  for(int i=0;i<(n+m)/2;i++){
    if(s.at(i)=='W') {
      int j=i+1;
      while(j<(n+m)*2){
        if(s.at(j)=='A'){
          s.at(j) = 'B';
          break;
        }
        j++;
      }
      if(j==(n+m)*2){
        cout << "No" << endl;
        return 0;
      }
    }
    else if(s.at(i)=='A') {
      int j=i+1;
      while(j<(n+m)*2){
        if(s.at(j)=='C'){
          s.at(j) = 'B';
          break;
        }
        j++;
      }
      if(j==(n+m)*2){
        cout << "No" << endl;
       return 0;
      }
    }
    else if(s.at(i)='B'){
      cout << "No" << endl;
        return 0;
    }

    

    if(s.at((n+m)*2-i-1)=='A') {
      int j=(n+m)*2-1;
      while(j>0){
        if(s.at(j)=='W'){
          s.at(j) = 'B';
          break;
        }
        j++;
      }
      if(j==0){
        cout << "No" << endl;
        return 0;
      }
    }
    else if(s.at((n+m)*2-i-1)=='C') {
      int j=(n+m)*2-1;
      while(j>0){
        if(s.at(j)=='A'){
          s.at(j) = 'B';
          break;
        }
        j++;
      }
      if(j==0){
        cout << "No" << endl;
        return 0;
      }
    }
    else if(s.at((n+m)*2-i-1) != 'B'){
        cout << "No" << endl;
        return 0;
    }
  }
  cout << "Yes" << endl;

  return 0;
}
0