結果
問題 |
No.762 PDCAパス
|
ユーザー |
![]() |
提出日時 | 2018-12-27 16:43:34 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 547 bytes |
コンパイル時間 | 78 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 34,848 KB |
最終ジャッジ日時 | 2024-10-01 14:52:25 |
合計ジャッジ時間 | 5,403 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 19 TLE * 1 -- * 18 |
ソースコード
N,M =map(int,input().split()) str =input() pdca ={l:set() for l in "PDCA"} line ={i+1:set() for i in range(N)} for i,st in enumerate(str): pdca[st].add(i+1) for i in range(M): s,t =map(int,input().split()) line[s].add(t) line[t].add(s) sum = 0 for np in pdca["P"]: for nd in line[np]: if nd in pdca["D"]: for nc in line[nd]: if nc in pdca["C"]: for nd in line[nc]: if nd in pdca["A"]: sum +=1 print(sum%1000000007)