結果

問題 No.2240 WAC
ユーザー ttkkggwwttkkggww
提出日時 2023-03-10 21:51:22
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 122 ms / 2,000 ms
コード長 645 bytes
コンパイル時間 4,442 ms
コンパイル使用メモリ 268,188 KB
実行使用メモリ 22,496 KB
最終ジャッジ日時 2023-10-18 07:38:13
合計ジャッジ時間 7,476 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
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 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 112 ms
22,496 KB
testcase_11 AC 122 ms
22,496 KB
testcase_12 AC 120 ms
22,496 KB
testcase_13 AC 30 ms
10,028 KB
testcase_14 AC 13 ms
6,480 KB
testcase_15 AC 63 ms
16,132 KB
testcase_16 AC 80 ms
18,140 KB
testcase_17 AC 52 ms
13,728 KB
testcase_18 AC 19 ms
6,924 KB
testcase_19 AC 24 ms
7,980 KB
testcase_20 AC 70 ms
17,148 KB
testcase_21 AC 37 ms
11,088 KB
testcase_22 AC 41 ms
12,088 KB
testcase_23 AC 31 ms
10,044 KB
testcase_24 AC 63 ms
15,940 KB
testcase_25 AC 61 ms
15,512 KB
testcase_26 AC 25 ms
8,244 KB
testcase_27 AC 18 ms
6,924 KB
testcase_28 AC 27 ms
9,036 KB
testcase_29 AC 9 ms
5,708 KB
testcase_30 AC 41 ms
12,124 KB
testcase_31 AC 87 ms
20,008 KB
testcase_32 AC 17 ms
6,660 KB
testcase_33 AC 44 ms
12,920 KB
testcase_34 AC 54 ms
14,820 KB
testcase_35 AC 7 ms
5,260 KB
testcase_36 AC 64 ms
16,096 KB
testcase_37 AC 75 ms
18,544 KB
testcase_38 AC 28 ms
9,572 KB
testcase_39 AC 89 ms
20,648 KB
testcase_40 AC 42 ms
12,144 KB
testcase_41 AC 55 ms
15,136 KB
testcase_42 AC 56 ms
14,904 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include<atcoder/all>
using namespace atcoder;
using ll = long long;
string s;

ll n,m;

void solve(){
	set<int> W,A,C;
	for(int i = 0;i<s.size();i++){
		if(s[i]=='W'){
			W.insert(i);
		}else if(s[i]=='A'){
			A.insert(i);
		}else{
			C.insert(i);
		}
	}
	for(auto &i:C){
		auto it = A.begin();
		if(i<(*it)){
			cout<<"No"<<endl;
			return;
		}
		A.erase(it);
	}
	for(auto &i:W){
		auto it = A.begin();
		if((*it)<i){
			cout<<"No"<<endl;
			return;
		}
		A.erase(it);
	}
	cout<<"Yes"<<endl;
}

signed main(){
	cin.tie(nullptr);
	ios::sync_with_stdio(false);
	cin >> n >> m;
	cin >> s;
	solve();
}
0