結果
| 問題 |
No.2240 WAC
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-03-10 21:34:09 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 77 ms / 2,000 ms |
| コード長 | 540 bytes |
| コンパイル時間 | 199 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 74,752 KB |
| 最終ジャッジ日時 | 2024-09-18 03:46:43 |
| 合計ジャッジ時間 | 3,745 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 43 |
ソースコード
import sys
input = sys.stdin.readline
from collections import *
N, M = map(int, input().split())
S = input()[:-1]
q = deque([])
ban = [False]*len(S)
for i in range(len(S)):
if S[i]=='C':
if len(q)==0:
exit(print('No'))
else:
ban[q.popleft()] = True
elif S[i]=='A':
q.append(i)
W = 0
for i in range(len(S)):
if ban[i]:
continue
if S[i]=='W':
W += 1
elif S[i]=='A':
W -= 1
if W<0:
exit(print('No'))
print('Yes')