結果
問題 |
No.2240 WAC
|
ユーザー |
![]() |
提出日時 | 2023-03-10 21:40:55 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 11 ms / 2,000 ms |
コード長 | 895 bytes |
コンパイル時間 | 3,891 ms |
コンパイル使用メモリ | 251,396 KB |
最終ジャッジ日時 | 2025-02-11 08:01:23 |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 43 |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; using namespace atcoder; using ll=long long; using ld=long double; ld pie=3.141592653589793; ll inf=155550555555555; ll mod=1000000007; int main(){ ll n,m; cin >> n >> m; string s; cin >> s; ll c=0,a=0; for (ll i = 0; i < s.size(); i++) { if (s[i]=='A') { a+=1; }else if (s[i]=='C') { c+=1; } if (c>a) { cout << "No" << endl; return 0; } } a=0; ll w=0; reverse(s.begin(),s.end()); for (ll i = 0; i < s.size(); i++) { if (s[i]=='W') { w+=1; }else if (s[i]=='A') { a+=1; } if (w>a) { cout << "No" << endl; return 0; } } cout << "Yes" << endl; }