結果

問題 No.762 PDCAパス
ユーザー convexineqconvexineq
提出日時 2021-03-31 02:21:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 286 ms / 2,000 ms
コード長 435 bytes
コンパイル時間 1,033 ms
コンパイル使用メモリ 87,064 KB
実行使用メモリ 100,980 KB
最終ジャッジ日時 2023-08-20 22:06:06
合計ジャッジ時間 9,373 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 95 ms
71,688 KB
testcase_01 AC 94 ms
71,600 KB
testcase_02 AC 95 ms
71,684 KB
testcase_03 AC 95 ms
71,580 KB
testcase_04 AC 95 ms
71,636 KB
testcase_05 AC 94 ms
71,744 KB
testcase_06 AC 94 ms
71,604 KB
testcase_07 AC 95 ms
71,688 KB
testcase_08 AC 93 ms
71,568 KB
testcase_09 AC 93 ms
71,672 KB
testcase_10 AC 93 ms
71,588 KB
testcase_11 AC 94 ms
71,604 KB
testcase_12 AC 96 ms
71,472 KB
testcase_13 AC 94 ms
71,472 KB
testcase_14 AC 94 ms
71,476 KB
testcase_15 AC 96 ms
71,472 KB
testcase_16 AC 95 ms
71,540 KB
testcase_17 AC 95 ms
71,456 KB
testcase_18 AC 95 ms
71,668 KB
testcase_19 AC 96 ms
71,628 KB
testcase_20 AC 95 ms
71,600 KB
testcase_21 AC 95 ms
71,816 KB
testcase_22 AC 178 ms
81,148 KB
testcase_23 AC 178 ms
81,296 KB
testcase_24 AC 267 ms
100,852 KB
testcase_25 AC 267 ms
100,980 KB
testcase_26 AC 183 ms
80,732 KB
testcase_27 AC 179 ms
80,812 KB
testcase_28 AC 283 ms
92,136 KB
testcase_29 AC 286 ms
91,988 KB
testcase_30 AC 274 ms
89,164 KB
testcase_31 AC 285 ms
88,824 KB
testcase_32 AC 276 ms
89,076 KB
testcase_33 AC 261 ms
89,276 KB
testcase_34 AC 267 ms
89,128 KB
testcase_35 AC 269 ms
89,292 KB
testcase_36 AC 237 ms
86,184 KB
testcase_37 AC 241 ms
86,072 KB
testcase_38 AC 241 ms
86,132 KB
testcase_39 AC 239 ms
86,600 KB
testcase_40 AC 237 ms
86,172 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,m = map(int,input().split())
s = input()
g = [[] for _ in range(n)]
for _ in range(m):
    a,b = map(int,input().split())
    g[a-1].append(b-1)
    g[b-1].append(a-1)

from collections import defaultdict
d = {i:1 for i in range(n) if s[i]=="P"}
for B in "DCA":
    nd = defaultdict(int)
    for k,v in d.items():
        for c in g[k]:
            if s[c] == B:
                nd[c] += v
    d = nd
print(sum(d.values())%(10**9+7))
0