結果

問題 No.762 PDCAパス
ユーザー R ITSUMIR ITSUMI
提出日時 2020-06-24 00:21:45
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 226 ms / 2,000 ms
コード長 536 bytes
コンパイル時間 371 ms
コンパイル使用メモリ 86,972 KB
実行使用メモリ 94,272 KB
最終ジャッジ日時 2023-09-16 20:21:50
合計ジャッジ時間 8,555 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 68 ms
71,344 KB
testcase_01 AC 68 ms
71,412 KB
testcase_02 AC 67 ms
71,100 KB
testcase_03 AC 68 ms
71,144 KB
testcase_04 AC 68 ms
71,100 KB
testcase_05 AC 66 ms
71,076 KB
testcase_06 AC 67 ms
71,100 KB
testcase_07 AC 65 ms
71,284 KB
testcase_08 AC 68 ms
71,044 KB
testcase_09 AC 69 ms
71,196 KB
testcase_10 AC 69 ms
71,148 KB
testcase_11 AC 67 ms
71,316 KB
testcase_12 AC 68 ms
71,220 KB
testcase_13 AC 68 ms
71,324 KB
testcase_14 AC 67 ms
71,164 KB
testcase_15 AC 68 ms
71,560 KB
testcase_16 AC 69 ms
71,344 KB
testcase_17 AC 69 ms
71,180 KB
testcase_18 AC 67 ms
71,440 KB
testcase_19 AC 68 ms
71,244 KB
testcase_20 AC 67 ms
71,148 KB
testcase_21 AC 68 ms
71,320 KB
testcase_22 AC 193 ms
88,084 KB
testcase_23 AC 192 ms
88,240 KB
testcase_24 AC 201 ms
93,788 KB
testcase_25 AC 198 ms
93,684 KB
testcase_26 AC 215 ms
88,376 KB
testcase_27 AC 219 ms
88,488 KB
testcase_28 AC 216 ms
94,272 KB
testcase_29 AC 226 ms
94,204 KB
testcase_30 AC 221 ms
93,108 KB
testcase_31 AC 224 ms
93,016 KB
testcase_32 AC 224 ms
93,152 KB
testcase_33 AC 224 ms
91,780 KB
testcase_34 AC 219 ms
91,800 KB
testcase_35 AC 219 ms
91,656 KB
testcase_36 AC 215 ms
89,292 KB
testcase_37 AC 215 ms
89,484 KB
testcase_38 AC 211 ms
89,376 KB
testcase_39 AC 204 ms
89,572 KB
testcase_40 AC 210 ms
89,296 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 10**9+7
N, M = map(int, input().split())
S = input()
G = [list(map(int, input().split())) for _ in range(M)]
edges = [[] for _ in range(N)]
check = ['PD','DC','CA']
for a, b in G:
    tmp1 = S[a-1]+S[b-1]
    tmp2 = S[b-1]+S[a-1]
    for i in check:
        if tmp1 == i:
            edges[a - 1].append(b - 1)
        if tmp2 == i:
            edges[b - 1].append(a - 1)
ans = 0
for i in range(N):
    if S[i]=="P":
        for j in edges[i]:
            for k in edges[j]:
                ans += len(edges[k])%MOD
print(ans%MOD)
0