結果

問題 No.2240 WAC
ユーザー 👑 rin204rin204
提出日時 2024-04-28 14:46:03
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 86 ms / 2,000 ms
コード長 429 bytes
コンパイル時間 249 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 95,128 KB
最終ジャッジ日時 2024-04-28 14:46:08
合計ジャッジ時間 4,129 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
51,840 KB
testcase_01 AC 36 ms
51,968 KB
testcase_02 AC 36 ms
51,712 KB
testcase_03 AC 36 ms
51,840 KB
testcase_04 AC 41 ms
51,840 KB
testcase_05 AC 38 ms
51,968 KB
testcase_06 AC 37 ms
52,096 KB
testcase_07 AC 36 ms
51,584 KB
testcase_08 AC 36 ms
51,840 KB
testcase_09 AC 36 ms
51,840 KB
testcase_10 AC 83 ms
94,080 KB
testcase_11 AC 80 ms
90,676 KB
testcase_12 AC 84 ms
95,128 KB
testcase_13 AC 64 ms
80,000 KB
testcase_14 AC 55 ms
69,248 KB
testcase_15 AC 76 ms
86,400 KB
testcase_16 AC 78 ms
87,552 KB
testcase_17 AC 72 ms
86,400 KB
testcase_18 AC 57 ms
72,320 KB
testcase_19 AC 57 ms
74,752 KB
testcase_20 AC 86 ms
86,968 KB
testcase_21 AC 66 ms
83,968 KB
testcase_22 AC 65 ms
85,376 KB
testcase_23 AC 62 ms
80,000 KB
testcase_24 AC 73 ms
85,356 KB
testcase_25 AC 72 ms
85,632 KB
testcase_26 AC 57 ms
75,392 KB
testcase_27 AC 59 ms
71,680 KB
testcase_28 AC 62 ms
77,824 KB
testcase_29 AC 51 ms
66,432 KB
testcase_30 AC 72 ms
85,760 KB
testcase_31 AC 80 ms
88,416 KB
testcase_32 AC 55 ms
71,040 KB
testcase_33 AC 70 ms
85,888 KB
testcase_34 AC 73 ms
86,400 KB
testcase_35 AC 54 ms
65,920 KB
testcase_36 AC 79 ms
85,248 KB
testcase_37 AC 76 ms
88,832 KB
testcase_38 AC 60 ms
78,208 KB
testcase_39 AC 82 ms
90,576 KB
testcase_40 AC 74 ms
85,760 KB
testcase_41 AC 79 ms
87,552 KB
testcase_42 AC 83 ms
87,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
WA = []
AC = []
c = 0
S = input()

for s in S:
    if s == "W":
        WA.append(1)
    elif s == "C":
        AC.append(-1)
    elif c < m:
        c += 1
        AC.append(1)
    else:
        WA.append(-1)


def ok(S):
    tot = 0
    for s in S:
        tot += s
        if tot < 0:
            return False
    return tot == 0


if ok(WA) and ok(AC):
    print("Yes")
else:
    print("No")
0