結果
問題 |
No.762 PDCAパス
|
ユーザー |
|
提出日時 | 2020-11-01 01:52:41 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 728 bytes |
コンパイル時間 | 319 ms |
コンパイル使用メモリ | 81,872 KB |
実行使用メモリ | 650,236 KB |
最終ジャッジ日時 | 2024-07-22 05:35:17 |
合計ジャッジ時間 | 6,233 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 16 WA * 3 MLE * 1 -- * 18 |
ソースコード
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()))