結果

問題 No.762 PDCAパス
ユーザー 👑 KazunKazun
提出日時 2020-06-10 17:15:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 263 ms / 2,000 ms
コード長 433 bytes
コンパイル時間 423 ms
コンパイル使用メモリ 86,824 KB
実行使用メモリ 95,556 KB
最終ジャッジ日時 2023-09-05 12:59:07
合計ジャッジ時間 8,340 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 77 ms
71,236 KB
testcase_01 AC 72 ms
71,356 KB
testcase_02 AC 71 ms
71,216 KB
testcase_03 AC 73 ms
71,124 KB
testcase_04 AC 74 ms
71,340 KB
testcase_05 AC 72 ms
71,180 KB
testcase_06 AC 73 ms
71,140 KB
testcase_07 AC 72 ms
71,336 KB
testcase_08 AC 73 ms
71,316 KB
testcase_09 AC 72 ms
71,392 KB
testcase_10 AC 72 ms
71,164 KB
testcase_11 AC 75 ms
71,180 KB
testcase_12 AC 73 ms
71,176 KB
testcase_13 AC 71 ms
71,168 KB
testcase_14 AC 76 ms
71,324 KB
testcase_15 AC 74 ms
71,172 KB
testcase_16 AC 73 ms
71,168 KB
testcase_17 AC 74 ms
71,024 KB
testcase_18 AC 73 ms
71,336 KB
testcase_19 AC 72 ms
71,280 KB
testcase_20 AC 73 ms
71,356 KB
testcase_21 AC 73 ms
71,104 KB
testcase_22 AC 187 ms
77,660 KB
testcase_23 AC 189 ms
77,812 KB
testcase_24 AC 242 ms
95,344 KB
testcase_25 AC 237 ms
95,504 KB
testcase_26 AC 259 ms
78,168 KB
testcase_27 AC 263 ms
78,204 KB
testcase_28 AC 247 ms
95,428 KB
testcase_29 AC 248 ms
95,556 KB
testcase_30 AC 249 ms
91,516 KB
testcase_31 AC 244 ms
91,716 KB
testcase_32 AC 242 ms
91,896 KB
testcase_33 AC 230 ms
85,788 KB
testcase_34 AC 232 ms
86,660 KB
testcase_35 AC 226 ms
85,732 KB
testcase_36 AC 207 ms
79,872 KB
testcase_37 AC 205 ms
79,784 KB
testcase_38 AC 206 ms
79,740 KB
testcase_39 AC 200 ms
79,752 KB
testcase_40 AC 202 ms
79,728 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def f(s):
    return int(s)-1

Z=10**9+7
N,M=map(int,input().split())
S=input()

X={("P","D"),("D","C"),("C","A")}

H={v:[] for v in range(N)}
for i in range(M):
    u,v=map(f,input().split())
    if (S[u],S[v]) in X:
        H[u].append(v)

    elif (S[v],S[u]) in X:
        H[v].append(u)

K=0
for i in range(N):
    if S[i]=="P":
        for j in H[i]:
            for k in H[j]:
                K=(K+len(H[k]))%Z

print(K)
    
0