結果

問題 No.2240 WAC
ユーザー tktk_snsntktk_snsn
提出日時 2023-03-10 21:37:38
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 212 ms / 2,000 ms
コード長 471 bytes
コンパイル時間 102 ms
コンパイル使用メモリ 11,836 KB
実行使用メモリ 28,088 KB
最終ジャッジ日時 2023-10-18 07:19:50
合計ジャッジ時間 5,686 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 29 ms
10,100 KB
testcase_01 AC 30 ms
10,100 KB
testcase_02 AC 28 ms
10,100 KB
testcase_03 AC 29 ms
10,100 KB
testcase_04 AC 29 ms
10,100 KB
testcase_05 AC 29 ms
10,100 KB
testcase_06 AC 29 ms
10,100 KB
testcase_07 AC 28 ms
10,100 KB
testcase_08 AC 29 ms
10,100 KB
testcase_09 AC 28 ms
10,100 KB
testcase_10 AC 212 ms
28,088 KB
testcase_11 AC 211 ms
27,552 KB
testcase_12 AC 195 ms
27,664 KB
testcase_13 AC 87 ms
16,092 KB
testcase_14 AC 56 ms
12,584 KB
testcase_15 AC 140 ms
21,660 KB
testcase_16 AC 172 ms
24,112 KB
testcase_17 AC 127 ms
19,752 KB
testcase_18 AC 66 ms
13,776 KB
testcase_19 AC 77 ms
14,544 KB
testcase_20 AC 154 ms
23,012 KB
testcase_21 AC 102 ms
17,504 KB
testcase_22 AC 100 ms
18,156 KB
testcase_23 AC 85 ms
16,120 KB
testcase_24 AC 140 ms
22,152 KB
testcase_25 AC 145 ms
21,484 KB
testcase_26 AC 77 ms
14,868 KB
testcase_27 AC 63 ms
13,552 KB
testcase_28 AC 81 ms
15,552 KB
testcase_29 AC 45 ms
11,992 KB
testcase_30 AC 103 ms
18,080 KB
testcase_31 AC 191 ms
25,796 KB
testcase_32 AC 62 ms
13,256 KB
testcase_33 AC 120 ms
18,816 KB
testcase_34 AC 141 ms
20,376 KB
testcase_35 AC 43 ms
11,420 KB
testcase_36 AC 151 ms
21,684 KB
testcase_37 AC 168 ms
24,132 KB
testcase_38 AC 84 ms
15,596 KB
testcase_39 AC 182 ms
26,244 KB
testcase_40 AC 117 ms
18,220 KB
testcase_41 AC 128 ms
20,684 KB
testcase_42 AC 126 ms
20,648 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

pos = [[] for _ in range(3)]
for i, s in enumerate(S):
    pos["WAC".index(s)].append(i)


ok = True

# Wのペア、Aの後ろのほうを貪欲に
A = pos[1][-N:]
for i in range(N):
    if pos[0][i] > A[i]:
        ok = False
        break

# Cのペア、Aの前のほうを貪欲に
A = pos[1][:M]
for i in range(M):
    if A[i] > pos[2][i]:
        ok = False
        break

if ok:
    print("Yes")
else:
    print("No")
0