結果

問題 No.2240 WAC
ユーザー 乾麺乾麺
提出日時 2024-05-15 16:11:25
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 895 bytes
コンパイル時間 3,575 ms
コンパイル使用メモリ 277,644 KB
実行使用メモリ 13,880 KB
最終ジャッジ日時 2024-05-15 16:12:05
合計ジャッジ時間 8,434 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
11,516 KB
testcase_01 AC 2 ms
6,816 KB
testcase_02 AC 1 ms
6,812 KB
testcase_03 AC 1 ms
6,816 KB
testcase_04 AC 1 ms
6,940 KB
testcase_05 AC 1 ms
6,944 KB
testcase_06 AC 1 ms
6,944 KB
testcase_07 AC 2 ms
6,944 KB
testcase_08 AC 2 ms
6,944 KB
testcase_09 AC 2 ms
6,940 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 TLE -
testcase_13 AC 261 ms
6,944 KB
testcase_14 AC 33 ms
6,940 KB
testcase_15 AC 1,735 ms
6,940 KB
testcase_16 TLE -
testcase_17 AC 847 ms
6,940 KB
testcase_18 AC 68 ms
6,948 KB
testcase_19 AC 559 ms
6,944 KB
testcase_20 AC 1,008 ms
6,944 KB
testcase_21 AC 566 ms
6,944 KB
testcase_22 TLE -
testcase_23 AC 905 ms
6,944 KB
testcase_24 AC 680 ms
6,940 KB
testcase_25 AC 670 ms
6,940 KB
testcase_26 AC 208 ms
6,940 KB
testcase_27 AC 63 ms
6,944 KB
testcase_28 AC 380 ms
6,940 KB
testcase_29 AC 50 ms
6,944 KB
testcase_30 AC 848 ms
6,944 KB
testcase_31 AC 1,656 ms
6,944 KB
testcase_32 AC 82 ms
6,944 KB
testcase_33 AC 658 ms
6,944 KB
testcase_34 AC 1,145 ms
6,944 KB
testcase_35 AC 12 ms
6,944 KB
testcase_36 AC 715 ms
6,944 KB
testcase_37 AC 1,315 ms
6,940 KB
testcase_38 AC 254 ms
6,944 KB
testcase_39 TLE -
testcase_40 AC 488 ms
6,940 KB
testcase_41 TLE -
testcase_42 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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";
}
0