結果

問題 No.2240 WAC
ユーザー titia
提出日時 2023-03-10 21:49:11
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
AC  
実行時間 267 ms / 2,000 ms
コード長 653 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 32,116 KB
最終ジャッジ日時 2024-09-18 04:04:56
合計ジャッジ時間 4,892 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M=map(int,input().split())
S=input()

LIST=[]

now=len(S)-1
for i in range(len(S)-1,-1,-1):
    if S[i]=="W":
        while S[now]!="A":
            now-=1

        if i<now:
            LIST.append(i)
            LIST.append(now)
            now-=1
        else:
            print("No")
            exit()

nozoku=set(LIST)

S2=[]
for i in range(len(S)):
    if i in nozoku:
        continue
    else:
        S2.append(S[i])

S=S2
now=len(S)-1
for i in range(len(S)-1,-1,-1):
    if S[i]=="A":
        while S[now]!="C":
            now-=1

        if i<now:
            now-=1
        else:
            print("No")
            exit()

print("Yes")
0