結果
問題 | No.2240 WAC |
ユーザー |
|
提出日時 | 2023-03-10 21:43:39 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 45 ms / 2,000 ms |
コード長 | 758 bytes |
コンパイル時間 | 605 ms |
コンパイル使用メモリ | 67,320 KB |
最終ジャッジ日時 | 2025-02-11 08:05:03 |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 43 |
ソースコード
#include <iostream>using namespace std;int main(){int n, m;string s;cin >> n >> m >> s;int l = (n + m) * 2;int a = 0;for (int i = 0; i < l; i++){if (s[i] == 'A'){a++;}if (s[i] == 'C'){a--;if (a < 0){cout << "No" << endl;return 0;}}}a = 0;for (int i = l - 1; i >= 0; i--){if (s[i] == 'A'){a++;}if (s[i] == 'W'){a--;if (a < 0){cout << "No" << endl;return 0;}}}cout << "Yes" << endl;}