結果

問題 No.2240 WAC
ユーザー ntudantuda
提出日時 2023-03-11 13:22:56
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 549 bytes
コンパイル時間 1,369 ms
コンパイル使用メモリ 81,408 KB
実行使用メモリ 484,604 KB
最終ジャッジ日時 2023-10-18 09:50:50
合計ジャッジ時間 6,025 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
57,752 KB
testcase_01 AC 37 ms
53,404 KB
testcase_02 AC 38 ms
53,404 KB
testcase_03 AC 38 ms
53,404 KB
testcase_04 AC 38 ms
53,404 KB
testcase_05 AC 38 ms
53,404 KB
testcase_06 AC 38 ms
53,404 KB
testcase_07 AC 37 ms
53,404 KB
testcase_08 AC 38 ms
53,404 KB
testcase_09 AC 38 ms
53,404 KB
testcase_10 TLE -
testcase_11 TLE -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(200050)

N, M = map(int, input().split())
N2 = (N + M) * 2
S = input()

Q = []

def dfs(x):
    if x == N2:
        if Q:
            return
        else:
            print("Yes")
            exit()
    if Q:
        if Q[-1] == "W" and S[x] == "A":
            tmp = Q.pop(-1)
            dfs(x + 1)
            Q.append(tmp)
        elif Q[-1] == "A" and S[x] == "C":
            tmp = Q.pop(-1)
            dfs(x + 1)
            Q.append(tmp)
    Q.append(S[x])
    dfs(x + 1)
    Q.pop(-1)


dfs(0)
print("No")
0