結果
| 問題 | No.2240 WAC | 
| コンテスト | |
| ユーザー |  shobonvip | 
| 提出日時 | 2023-03-06 00:42:26 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 76 ms / 2,000 ms | 
| コード長 | 630 bytes | 
| コンパイル時間 | 381 ms | 
| コンパイル使用メモリ | 82,304 KB | 
| 実行使用メモリ | 66,048 KB | 
| 最終ジャッジ日時 | 2024-09-18 01:46:06 | 
| 合計ジャッジ時間 | 4,832 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge2 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 43 | 
ソースコード
n, m = map(int,input().split())
s = input()
assert 1 <= n <= 10 ** 5
assert 1 <= m <= 10 ** 5
w = s.count("W")
a = s.count("A")
c = s.count("C")
assert w == n
assert a == n + m
assert c == m
assert len(s) == 2*(n+m)
pivot = 0
for i in range(2*(n+m)):
	if s[i] == "C":
		mode = 0
		while pivot < i and mode == 0:
			if s[pivot] == "A":
				mode = 1
			pivot += 1
		if mode == 0:
			print("No")
			exit()
for i in range(2*(n+m)):
	if s[i] == "W":
		mode = 0
		pivot = max(pivot, i + 1)
		while pivot < 2*(n+m) and mode == 0:
			if s[pivot] == "A":
				mode = 1
			pivot += 1
		if mode == 0:
			print("No")
			exit()
print("Yes")
            
            
            
        