結果

問題 No.2240 WAC
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2023-03-10 21:59:09
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 80 ms / 2,000 ms
コード長 533 bytes
コンパイル時間 1,249 ms
コンパイル使用メモリ 81,732 KB
実行使用メモリ 83,896 KB
最終ジャッジ日時 2023-10-18 07:45:50
合計ジャッジ時間 4,414 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
53,320 KB
testcase_01 AC 42 ms
53,320 KB
testcase_02 AC 43 ms
53,320 KB
testcase_03 AC 43 ms
53,320 KB
testcase_04 AC 42 ms
53,320 KB
testcase_05 AC 41 ms
53,320 KB
testcase_06 AC 42 ms
53,320 KB
testcase_07 AC 42 ms
53,320 KB
testcase_08 AC 42 ms
53,320 KB
testcase_09 AC 42 ms
53,320 KB
testcase_10 AC 80 ms
83,896 KB
testcase_11 AC 72 ms
74,340 KB
testcase_12 AC 60 ms
70,168 KB
testcase_13 AC 44 ms
56,684 KB
testcase_14 AC 42 ms
55,828 KB
testcase_15 AC 45 ms
57,976 KB
testcase_16 AC 76 ms
76,968 KB
testcase_17 AC 44 ms
57,456 KB
testcase_18 AC 65 ms
71,024 KB
testcase_19 AC 60 ms
66,980 KB
testcase_20 AC 45 ms
58,196 KB
testcase_21 AC 66 ms
69,800 KB
testcase_22 AC 55 ms
67,656 KB
testcase_23 AC 54 ms
65,184 KB
testcase_24 AC 61 ms
70,676 KB
testcase_25 AC 73 ms
75,948 KB
testcase_26 AC 43 ms
56,200 KB
testcase_27 AC 43 ms
55,964 KB
testcase_28 AC 55 ms
66,868 KB
testcase_29 AC 50 ms
64,192 KB
testcase_30 AC 44 ms
57,120 KB
testcase_31 AC 44 ms
58,852 KB
testcase_32 AC 60 ms
68,824 KB
testcase_33 AC 44 ms
57,284 KB
testcase_34 AC 45 ms
57,680 KB
testcase_35 AC 42 ms
55,612 KB
testcase_36 AC 75 ms
76,100 KB
testcase_37 AC 46 ms
58,516 KB
testcase_38 AC 56 ms
67,016 KB
testcase_39 AC 63 ms
71,740 KB
testcase_40 AC 43 ms
57,124 KB
testcase_41 AC 58 ms
68,308 KB
testcase_42 AC 58 ms
68,260 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
n,m = map(int,input().split())
S = input()
le = len(S)
used = [0]*(le)
A = deque()
for i in range(le)[::-1]:
    # print(i,S[i],A)
    if S[i] == "W":
        if not A:
            print("No")
            exit()
        used[A.popleft()] = 1
    
    if S[i] == "A":
        A.append(i)

A = []
for i in range(le):
    # print(i,S[i],A)
    if S[i] == "C":
        if not A:
            print("No")
            exit()
        A.pop()
    if S[i] == "A" and used[i] == 0:
        A.append(i)
print("Yes")
0