結果
問題 | No.2240 WAC |
ユーザー |
![]() |
提出日時 | 2024-05-15 16:11:25 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
TLE
|
実行時間 | - |
コード長 | 895 bytes |
コンパイル時間 | 3,468 ms |
コンパイル使用メモリ | 277,084 KB |
実行使用メモリ | 13,644 KB |
最終ジャッジ日時 | 2024-12-20 10:21:15 |
合計ジャッジ時間 | 46,342 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 35 TLE * 8 |
ソースコード
#define _GLIBCXX_DEBUG#include <bits/stdc++.h>#include <atcoder/dsu>#include <atcoder/segtree>using namespace atcoder;using namespace std;typedef long long ll;#define rep(i,a,b) for(int i=a;i<b;i++)using vi = vector<int>;using vvi = vector<vi>;using li =vector<ll>;using lli=vector<li>;using si =vector<char>;using ssi =vector<si>;const long long INF = 1e18;const long long MOD=1e9+7;//for (auto [key, val] : mp)int main() { int n,m;string s;cin>>n>>m>>s;string wa,ac;int cnt=0;for(int i=2*n+2*m;i>=0;i--){if(s[i]=='A'&&cnt<n){wa="A"+wa;cnt++;}else if(s[i]=='W')wa="W"+wa;}cnt=0;rep(i,0,2*n+2*m){if(s[i]=='A'&&cnt<m){ac=ac+"A";cnt++;}else if(s[i]=='C')ac=ac+"C";}//cout<<wa<<" "<<ac<<endl;cnt=0;rep(i,0,2*n){if(wa[i]=='W')cnt++;else cnt--;if(cnt<0){cout<<"No";return 0;}}cnt=0;rep(i,0,2*m){if(ac[i]=='A')cnt++;else cnt--;if(cnt<0){cout<<"No";return 0;}}cout<<"Yes";}