結果

問題 No.2240 WAC
ユーザー ninja-kidninja-kid
提出日時 2023-03-11 07:55:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 89 ms / 2,000 ms
コード長 857 bytes
コンパイル時間 888 ms
コンパイル使用メモリ 81,664 KB
実行使用メモリ 93,164 KB
最終ジャッジ日時 2023-10-18 09:41:47
合計ジャッジ時間 4,290 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
55,456 KB
testcase_01 AC 41 ms
55,456 KB
testcase_02 AC 40 ms
55,456 KB
testcase_03 AC 41 ms
55,456 KB
testcase_04 AC 40 ms
55,456 KB
testcase_05 AC 41 ms
55,456 KB
testcase_06 AC 40 ms
55,456 KB
testcase_07 AC 45 ms
55,456 KB
testcase_08 AC 41 ms
55,456 KB
testcase_09 AC 40 ms
55,456 KB
testcase_10 AC 85 ms
90,784 KB
testcase_11 AC 89 ms
93,164 KB
testcase_12 AC 83 ms
93,164 KB
testcase_13 AC 56 ms
70,816 KB
testcase_14 AC 56 ms
68,364 KB
testcase_15 AC 63 ms
80,364 KB
testcase_16 AC 82 ms
86,828 KB
testcase_17 AC 69 ms
78,464 KB
testcase_18 AC 59 ms
70,912 KB
testcase_19 AC 60 ms
70,528 KB
testcase_20 AC 66 ms
79,028 KB
testcase_21 AC 63 ms
77,040 KB
testcase_22 AC 61 ms
73,384 KB
testcase_23 AC 57 ms
71,224 KB
testcase_24 AC 64 ms
77,780 KB
testcase_25 AC 72 ms
80,692 KB
testcase_26 AC 60 ms
72,992 KB
testcase_27 AC 59 ms
70,724 KB
testcase_28 AC 55 ms
69,764 KB
testcase_29 AC 50 ms
63,780 KB
testcase_30 AC 58 ms
74,288 KB
testcase_31 AC 87 ms
91,168 KB
testcase_32 AC 57 ms
69,180 KB
testcase_33 AC 66 ms
78,256 KB
testcase_34 AC 74 ms
82,672 KB
testcase_35 AC 56 ms
66,004 KB
testcase_36 AC 79 ms
84,856 KB
testcase_37 AC 69 ms
80,448 KB
testcase_38 AC 56 ms
70,604 KB
testcase_39 AC 70 ms
83,976 KB
testcase_40 AC 66 ms
77,040 KB
testcase_41 AC 62 ms
77,004 KB
testcase_42 AC 61 ms
76,680 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
from collections import deque


dpos4 = ((1, 0), (0, 1), (-1, 0), (0, -1))
dpos8 = ((0, -1), (1, -1), (1, 0), (1, 1), (0, 1), (-1, 1), (-1, 0), (-1, -1))
mod1 = 10**9 + 7
mod2 = 998244353
inf = 1 << 60


def main():
    N, M = map(int, input().split())

    W = []
    C = []
    A = deque()
    S = input()
    for i in range(len(S)):
        if S[i] == "W":
            W.append(i)
        elif S[i] == "C":
            C.append(i)
        else:
            A.append(i)

    def solve():
        for c in C:
            if not A or A[0] >= c:
                return False
            A.popleft()
        for w in W:
            if not A or A[0] <= w:
                return False
            A.popleft()
        return True

    if solve():
        print("Yes")
    else:
        print("No")


if __name__ == "__main__":
    main()
0