結果

問題 No.2240 WAC
ユーザー srjywrdnprkt
提出日時 2023-04-22 05:41:05
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 819 bytes
コンパイル時間 999 ms
コンパイル使用メモリ 105,132 KB
最終ジャッジ日時 2025-02-12 12:56:35
ジャッジサーバーID
(参考情報)
judge3 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 33 WA * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
#include <cassert>

using namespace std;
using ll = long long;

int main(){

    int N, M, w=0, a, c=0;
    string S;
    cin >> N >> M >> S;
    a = N+M;
 
    for (int i=0; i<(N+M)*2; i++){
        if (S[i] == 'W') w++;
        else if (S[i] == 'A') a--;
        if (w > a && w != N){
            cout << "No" << endl;
            return 0;
        }
    }
    a = N+M;
    for (int i=(N+M)*2-1; i>=0; i--){
        if (S[i] == 'C') c++;
        else if (S[i] == 'A') a--;
        if (c > a && c != M){
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;

    return 0;
}
0