結果

問題 No.2240 WAC
ユーザー GlinTFraulein
提出日時 2023-03-10 22:46:09
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 882 bytes
コンパイル時間 3,791 ms
コンパイル使用メモリ 251,076 KB
最終ジャッジ日時 2025-02-11 08:53:02
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 37 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
 
#define elif else if
#define ll long long
#define vll vector<long long>
#define vec vector
#define embk emplace_back
#define rep(i, n) for (int i = 0; i < n; i++)
#define rep3(i, n, k) for (int i = k; i < n; i++)
#define all(a) a.begin(), a.end()
 
using namespace std;
using namespace atcoder;
const ll INF = 1LL << 60;
const ll mod = 998244353;

int main() {
  ll n, m; cin >> n >> m;
  string s; cin >> s;
  ll ss = s.size();
  
  vec<bool> used(n+m);
  ll count = 0;
  rep(i, ss) {
    if (s[ss-i-1] == 'A') count++;
    elif (s[ss-i-1] == 'W') {
      count--;
      if (count < 0) {
        cout << "No" << endl;
        return 0;
      }
    }
  }
    
  rep(i, ss) {
    if (s[i] == 'A') {
      cout << "Yes" << endl;
      return 0;
    }
    elif (s[i] == 'C') {
      cout << "No" << endl;
      return 0;
    }
  }
  
}
0