結果
問題 | No.2240 WAC |
ユーザー |
![]() |
提出日時 | 2024-05-19 19:32:05 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 6 ms / 2,000 ms |
コード長 | 793 bytes |
コンパイル時間 | 1,922 ms |
コンパイル使用メモリ | 198,752 KB |
最終ジャッジ日時 | 2025-02-21 16:03:49 |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 43 |
ソースコード
#include<bits/stdc++.h>using namespace std;int main(){ios::sync_with_stdio(false);cin.tie(nullptr);int N,M;cin>>N>>M;string S;cin>>S;stack<char>AC,WA;for(char& c:S){if(c=='W')WA.push(c);else if(c=='A'){if(M==0){if(WA.empty()){cout<<"No"<<endl;return 0;}WA.pop();}else{M--;AC.push(c);}}else{if(AC.empty()){cout<<"No"<<endl;return 0;}AC.pop();}}cout<<"Yes"<<endl;}