結果

問題 No.2240 WAC
ユーザー hikaririhikariri
提出日時 2023-03-27 17:59:26
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,699 bytes
コンパイル時間 4,799 ms
コンパイル使用メモリ 230,668 KB
実行使用メモリ 10,280 KB
最終ジャッジ日時 2023-10-19 17:09:30
合計ジャッジ時間 6,060 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 WA -
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 WA -
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 20 ms
10,220 KB
testcase_11 WA -
testcase_12 AC 18 ms
10,220 KB
testcase_13 AC 7 ms
5,876 KB
testcase_14 AC 3 ms
4,432 KB
testcase_15 AC 10 ms
7,844 KB
testcase_16 AC 18 ms
8,636 KB
testcase_17 AC 14 ms
7,196 KB
testcase_18 AC 6 ms
4,960 KB
testcase_19 AC 7 ms
5,224 KB
testcase_20 AC 11 ms
8,372 KB
testcase_21 WA -
testcase_22 AC 10 ms
6,404 KB
testcase_23 AC 7 ms
5,876 KB
testcase_24 AC 15 ms
7,844 KB
testcase_25 AC 15 ms
7,844 KB
testcase_26 AC 7 ms
5,224 KB
testcase_27 AC 5 ms
4,696 KB
testcase_28 AC 8 ms
5,488 KB
testcase_29 AC 4 ms
4,348 KB
testcase_30 AC 11 ms
6,404 KB
testcase_31 AC 20 ms
9,428 KB
testcase_32 WA -
testcase_33 AC 13 ms
6,668 KB
testcase_34 AC 14 ms
7,460 KB
testcase_35 AC 4 ms
4,348 KB
testcase_36 WA -
testcase_37 AC 12 ms
8,900 KB
testcase_38 AC 8 ms
5,612 KB
testcase_39 AC 20 ms
9,428 KB
testcase_40 AC 11 ms
6,404 KB
testcase_41 AC 14 ms
7,460 KB
testcase_42 AC 14 ms
7,460 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
typedef modint998244353 mint;
#endif
typedef long long  ll;
typedef pair<int,int> pii; typedef pair<ll,ll> pll;
const int INF = 1e9; const long long LINF = 1e18;
const int MOD = 998244353; const int MOD1 = 1e9+7;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define all(x) x.begin(), x.end()
template<typename T> bool chmin(T& a, T b){if(a > b){a = b; return true;} return false;}
template<typename T> bool chmax(T& a, T b){if(a < b){a = b; return true;} return false;}
void yorn(bool ans){cout << (ans?"Yes":"No") << endl; return;}

// しばらくはsize_tをキャストに任せてみようかな
int main(){
    int n,m; cin >> n >> m;
    string s; cin >> s;
    int l = (n+m)*2;

    vector<int> w(l),c(l),a1(l),a2(l);
    if(s.at(0)=='C'||s.back()=='W'){cout << "No" << endl; return 0;}

    if(s.at(0)=='A') a1.at(0) = 1;
    if(s.back()=='A') a2.at(0) = 1;
    for(int i=1;i<l;i++){
        if(s.at(i)=='C') c.at(i)++;
        c.at(i) += c.at(i-1);
        if(s.at(i) =='A') a1.at(i)++;
        a1.at(i) += a1.at(i-1);
    }
    for(int i=l-2;i>=0;i--){
        if(s.at(i)=='W') w.at(i)++;
        w.at(i) += w.at(i+1);
        if(s.at(i) =='A') a2.at(i)++;
        a2.at(i) += a2.at(i+1);
    }
    /*rep(i,l) cout << a1.at(i) << ' '; cout << endl;
    rep(i,l) cout << c.at(i) << ' '; cout << endl;
    rep(i,l) cout << a2.at(i) << ' '; cout << endl;
    rep(i,l) cout << w.at(i) << ' '; cout << endl;*/
    rep(i,l){
        if(a1.at(i)-c.at(i)<0 || a2.at(i)-w.at(i)<0){
            cout << "No" << endl; return 0;
        }
    }
    cout << "Yes" << endl;
}
0