結果

問題 No.762 PDCAパス
ユーザー yakeshibayakeshiba
提出日時 2020-11-01 01:52:41
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 728 bytes
コンパイル時間 413 ms
コンパイル使用メモリ 86,908 KB
実行使用メモリ 638,920 KB
最終ジャッジ日時 2023-09-29 10:59:15
合計ジャッジ時間 8,076 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 98 ms
75,756 KB
testcase_01 AC 95 ms
71,776 KB
testcase_02 AC 94 ms
71,608 KB
testcase_03 AC 94 ms
71,552 KB
testcase_04 AC 96 ms
71,436 KB
testcase_05 AC 95 ms
71,640 KB
testcase_06 AC 94 ms
71,680 KB
testcase_07 AC 95 ms
71,604 KB
testcase_08 AC 95 ms
71,784 KB
testcase_09 AC 96 ms
71,680 KB
testcase_10 AC 96 ms
71,596 KB
testcase_11 AC 94 ms
71,744 KB
testcase_12 AC 95 ms
71,516 KB
testcase_13 AC 96 ms
71,644 KB
testcase_14 AC 95 ms
71,468 KB
testcase_15 AC 96 ms
71,704 KB
testcase_16 AC 95 ms
71,580 KB
testcase_17 AC 96 ms
71,552 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 94 ms
71,392 KB
testcase_22 MLE -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import defaultdict

n, m = map(int,input().split())
S = input()
ind = defaultdict(list)
for i,s in enumerate(S):
    ind[s].append(i)

edge = [[] for _ in range(n)]
for _ in range(m):
    u, v = map(lambda x:int(x)-1,input().split())
    edge[u].append(v)
    edge[v].append(u)
  
D = {}
C = {}
A = {}
for i in ind["P"]:
    for to in edge[i]:
        if S[to] == "D":
            D[str(i)+str(to)] = 1
#print(D)
            
for i in D.keys():
    j = int(i[-1])
    for to in edge[j]:
        if S[to] == "C":
            C[i+str(to)] = 1
#print(C)

for i in C.keys():
    j = int(i[-1])
    for to in edge[j]:
        if S[to] == "A":
            A[i+str(to)] = 1
            
#print(A)

print(len(A.keys()))
0