結果

問題 No.2240 WAC
コンテスト
ユーザー Muhammad Ashar Usmani
提出日時 2025-11-17 14:09:31
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 615 bytes
コンパイル時間 1,793 ms
コンパイル使用メモリ 194,996 KB
実行使用メモリ 7,720 KB
最終ジャッジ日時 2025-11-17 14:09:35
合計ジャッジ時間 3,499 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 32 WA * 11
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    long long N, M;
    if (!(cin >> N >> M)) return 0;
    string s; cin >> s;
    long long w = 0, a = 0, wa = 0, ac = 0;
    for (char c : s) {
        if (c == 'W') w++;
        else if (c == 'A') {
            if (w > 0) { w--; wa++; }
            else a++;
        } else if (c == 'C') {
            if (a > 0) { a--; ac++; }
            else { cout << "No\n"; return 0; }
        }
    }
    if (wa == N && ac == M && w == 0 && a == 0) cout << "Yes\n";
    else cout << "No\n";
    return 0;
}
0